1 import ./make-test-python.nix (
5 meta.maintainers = lib.teams.flyingcircus.members;
10 services.mailpit.instances.default = { };
12 environment.systemPackages = with pkgs; [ swaks ];
18 from json import loads
20 machine.wait_for_unit("mailpit-default.service")
21 machine.wait_for_open_port(1025)
22 machine.wait_for_open_port(8025)
24 'echo "this is the body of the email" | swaks --to root@example.org --body - --server localhost:1025'
27 received = loads(machine.succeed("curl http://localhost:8025/api/v1/messages"))
28 assert received['total'] == 1
29 message = received["messages"][0]
30 assert len(message['To']) == 1
31 assert message['To'][0]['Address'] == 'root@example.org'
32 assert "this is the body of the email" in message['Snippet']