@@ -18,6 +18,18 @@ import ./make-test.nix {
1818 MAIL
1919 '';
2020
21+ sendTestMailViaDeliveryAgent = pkgs.writeScriptBin "send-lda" ''
22+ #!${pkgs.stdenv.shell}
23+
24+ exec ${pkgs.dovecot}/libexec/dovecot/deliver -d bob <<MAIL
25+ From: root@localhost
26+ To: bob@localhost
27+ Subject: Something else...
28+
29+ I'm running short of ideas!
30+ MAIL
31+ '';
32+
2133 testImap = pkgs.writeScriptBin "test-imap" ''
2234 #!${pkgs.python3.interpreter}
2335 import imaplib
@@ -39,24 +51,25 @@ import ./make-test.nix {
3951
4052 pop = poplib.POP3('localhost')
4153 try:
42− pop.user('alice')
54+ pop.user('bob')
4355 pop.pass_('foobar')
4456 assert len(pop.list()[1]) == 1
4557 status, fullmail, size = pop.retr(1)
4658 assert status.startswith(b'+OK ')
4759 body = b"".join(fullmail[fullmail.index(b""):]).strip()
48− assert body == b'Hello world!'
60+ assert body == b"I'm running short of ideas!"
4961 finally:
5062 pop.quit()
5163 '';
5264
53− in [ sendTestMail testImap testPop ];
65+ in [ sendTestMail sendTestMailViaDeliveryAgent testImap testPop ];
5466 };
5567
5668 testScript = ''
5769 $machine->waitForUnit('postfix.service');
5870 $machine->waitForUnit('dovecot2.service');
5971 $machine->succeed('send-testmail');
72+ $machine->succeed('send-lda');
6073 $machine->waitUntilFails('[ "$(postqueue -p)" != "Mail queue is empty" ]');
6174 $machine->succeed('test-imap');
6275 $machine->succeed('test-pop');