2020-12-17 16:58:57 +01:00
|
|
|
import ./make-test-python.nix ({ lib, ... }: {
|
|
|
|
name = "mailhog";
|
|
|
|
meta.maintainers = with lib.maintainers; [ jojosch ];
|
|
|
|
|
2022-03-21 00:15:30 +01:00
|
|
|
nodes.machine = { pkgs, ... }: {
|
2020-12-17 16:58:57 +01:00
|
|
|
services.mailhog.enable = true;
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [ swaks ];
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
|
|
|
|
|
|
|
machine.wait_for_unit("mailhog.service")
|
2022-06-11 14:22:53 +02:00
|
|
|
machine.wait_for_open_port(1025)
|
|
|
|
machine.wait_for_open_port(8025)
|
2020-12-17 16:58:57 +01:00
|
|
|
machine.succeed(
|
|
|
|
'echo "this is the body of the email" | swaks --to root@example.org --body - --server localhost:1025'
|
|
|
|
)
|
|
|
|
assert "this is the body of the email" in machine.succeed(
|
|
|
|
"curl --fail http://localhost:8025/api/v2/messages"
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
})
|