1import ./make-test-python.nix ({ lib, ... }:
2
3{
4 name = "mailcatcher";
5 meta.maintainers = [ lib.maintainers.aanderse ];
6
7 machine =
8 { pkgs, ... }:
9 {
10 services.mailcatcher.enable = true;
11
12 services.ssmtp.enable = true;
13 services.ssmtp.hostName = "localhost:1025";
14
15 environment.systemPackages = [ pkgs.mailutils ];
16 };
17
18 testScript = ''
19 start_all()
20
21 machine.wait_for_unit("mailcatcher.service")
22 machine.wait_for_open_port("1025")
23 machine.succeed(
24 'echo "this is the body of the email" | mail -s "subject" root@example.org'
25 )
26 assert "this is the body of the email" in machine.succeed(
27 "curl -f http://localhost:1080/messages/1.source"
28 )
29 '';
30})