2019-12-15 15:21:38 +01:00
|
|
|
import ./make-test-python.nix ({ lib, ... }:
|
2019-03-27 12:35:24 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
name = "mailcatcher";
|
|
|
|
meta.maintainers = [ lib.maintainers.aanderse ];
|
|
|
|
|
2022-03-21 00:15:30 +01:00
|
|
|
nodes.machine =
|
2019-03-27 12:35:24 +01:00
|
|
|
{ pkgs, ... }:
|
|
|
|
{
|
|
|
|
services.mailcatcher.enable = true;
|
|
|
|
|
2022-04-03 17:41:03 +02:00
|
|
|
programs.msmtp = {
|
|
|
|
enable = true;
|
|
|
|
accounts.default = {
|
|
|
|
host = "localhost";
|
|
|
|
port = 1025;
|
|
|
|
};
|
|
|
|
};
|
2019-03-27 12:35:24 +01:00
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.mailutils ];
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2019-12-15 15:21:38 +01:00
|
|
|
start_all()
|
2019-03-27 12:35:24 +01:00
|
|
|
|
2019-12-15 15:21:38 +01:00
|
|
|
machine.wait_for_unit("mailcatcher.service")
|
2022-06-11 14:22:53 +02:00
|
|
|
machine.wait_for_open_port(1025)
|
2019-12-15 15:21:38 +01: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-09-16 16:44:27 +02:00
|
|
|
"curl -f http://localhost:1080/messages/1.source"
|
2019-12-15 15:21:38 +01:00
|
|
|
)
|
2019-03-27 12:35:24 +01:00
|
|
|
'';
|
|
|
|
})
|