2020-04-24 23:36:52 +00:00
|
|
|
import ./make-test-python.nix ({ lib, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
name = "mailcatcher";
|
|
|
|
meta.maintainers = [ lib.maintainers.aanderse ];
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
nodes.machine =
|
2020-04-24 23:36:52 +00:00
|
|
|
{ pkgs, ... }:
|
|
|
|
{
|
|
|
|
services.mailcatcher.enable = true;
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
programs.msmtp = {
|
|
|
|
enable = true;
|
|
|
|
accounts.default = {
|
|
|
|
host = "localhost";
|
|
|
|
port = 1025;
|
|
|
|
};
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.mailutils ];
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
|
|
|
|
|
|
|
machine.wait_for_unit("mailcatcher.service")
|
2022-06-16 17:23:12 +00:00
|
|
|
machine.wait_for_open_port(1025)
|
2020-04-24 23:36:52 +00:00
|
|
|
machine.succeed(
|
|
|
|
'echo "this is the body of the email" | mail -s "subject" root@example.org'
|
|
|
|
)
|
|
|
|
assert "this is the body of the email" in machine.succeed(
|
2020-10-27 00:29:36 +00:00
|
|
|
"curl -f http://localhost:1080/messages/1.source"
|
2020-04-24 23:36:52 +00:00
|
|
|
)
|
|
|
|
'';
|
|
|
|
})
|