From 51058db71e47ccd98af2044698ec44682b52ba23 Mon Sep 17 00:00:00 2001 From: Ruben Maher Date: Wed, 20 Dec 2017 09:34:09 +1030 Subject: [PATCH] tests/extern: assert catchall doesn't steal from existing accounts --- tests/extern.nix | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/tests/extern.nix b/tests/extern.nix index e4c11ba..28fff3b 100644 --- a/tests/extern.nix +++ b/tests/extern.nix @@ -48,7 +48,9 @@ import { }; client = { config, pkgs, ... }: { - environment.systemPackages = with pkgs; [ fetchmail msmtp procmail ]; + environment.systemPackages = with pkgs; [ + fetchmail msmtp procmail findutils + ]; }; }; @@ -88,6 +90,13 @@ import { from chuck\@example.com user user2\@example.com password user2 + + account test4 + host SERVER + port 587 + from postmaster\@example.com + user user1\@example.com + password user1 ''; email1 = '' @@ -117,6 +126,20 @@ import { XOXO User1 ''; + email3 = + '' + From: Postmaster + To: Chuck + Cc: + Bcc: + Subject: This is a test Email from postmaster\@example.com to chuck + Reply-To: + + Hello Chuck, + + I think I may have misconfigured the mail server + XOXO Postmaster + ''; in '' startAll; @@ -196,6 +219,16 @@ import { $client->succeed("sleep 5"); # fetchmail returns EXIT_CODE 0 when it retrieves mail $client->succeed("fetchmail -v"); + + $client->succeed("rm ~/mail/*"); + $client->succeed("rm mail.txt"); + $client->succeed("echo '${email2}' > mail.txt"); + # send email from user1 to chuck + $client->succeed("msmtp -a test4 --tls=on --tls-certcheck=off --auth=on chuck\@example.com < mail.txt >&2"); + $client->succeed("sleep 5"); + # fetchmail returns EXIT_CODE 1 when no new mail + # if this succeeds, it means that user1 recieved the mail that was intended for chuck. + $client->fail("fetchmail -v"); };