From: Baptiste Daroussin Date: Sat, 15 Apr 2023 19:20:40 +0000 (+0200) Subject: do_all_the_voodoo_here: cover with tests X-Git-Tag: RELEASE_1_4_0b1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2246ab31eedc7b56225589245251f6eca48060a7;p=thirdparty%2Fmlmmj.git do_all_the_voodoo_here: cover with tests --- diff --git a/tests/mlmmj-receive.sh b/tests/mlmmj-receive.sh index a09c19f9..3418c3cc 100755 --- a/tests/mlmmj-receive.sh +++ b/tests/mlmmj-receive.sh @@ -20,7 +20,8 @@ tests_init \ moderation_notmetoo \ moderation_reject_invalid \ maxmailsize \ - maxmailsize0 + maxmailsize0 \ + normail_email mlmmjreceive=$(command -v mlmmj-receive) @@ -2312,3 +2313,150 @@ EOF atf_check -s exit:1 test -f mail-2.txt return } + +normail_email_body() +{ + atf_check $srcdir/fakesmtpd + trap kill_fakesmtp EXIT TERM + init_ml list + rmdir list/text + ln -s ${srcdir}/../listtexts/en list/text + echo test@mlmmjtest > list/control/listaddress + echo "25678" > list/control/smtpport + echo "heloname" > list/control/smtphelo + + printf "user@test\nuser2@test" > list/subscribers.d/u +cat > first < nosubject <> expected-1.txt < +RCPT TO: +DATA +From: bob@test +To: test@mlmmjtest +Subject: yeah + +Let's go, first email + +. +MAIL FROM: +RCPT TO: +DATA +From: bob@test +To: test@mlmmjtest +Subject: yeah + +Let's go, first email + +. +QUIT +EOF + atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt + touch list/control/footer + atf_check -s exit:0 $mlmmjreceive -L list -F list/control/footer + touch list/control/prefix + atf_check -s exit:0 $mlmmjreceive -L list -F > expected-2.txt < +RCPT TO: +DATA +From: bob@test +To: test@mlmmjtest +Subject: yeah + +Let's go, first email +myfooter +really +. +MAIL FROM: +RCPT TO: +DATA +From: bob@test +To: test@mlmmjtest +Subject: yeah + +Let's go, first email +myfooter +really +. +QUIT +EOF + atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-3.txt + echo "[plop]" > list/control/prefix + atf_check -s exit:0 $mlmmjreceive -L list -F > expected-3.txt < +RCPT TO: +DATA +From: bob@test +To: test@mlmmjtest +Subject: [plop] yeah + +Let's go, first email +myfooter +really +. +MAIL FROM: +RCPT TO: +DATA +From: bob@test +To: test@mlmmjtest +Subject: [plop] yeah + +Let's go, first email +myfooter +really +. +QUIT +EOF + atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-4.txt + + atf_check -s exit:0 $mlmmjreceive -L list -F > expected-4.txt < +RCPT TO: +DATA +From: bob@test +To: test@mlmmjtest +Subject: [plop] + +Let's go, first email +myfooter +really +. +MAIL FROM: +RCPT TO: +DATA +From: bob@test +To: test@mlmmjtest +Subject: [plop] + +Let's go, first email +myfooter +really +. +QUIT +EOF + atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-5.txt +}