]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
test: add a unit test about #30
authorBaptiste Daroussin <bapt@FreeBSD.org>
Fri, 31 May 2024 08:54:46 +0000 (10:54 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Fri, 31 May 2024 08:55:32 +0000 (10:55 +0200)
tests/mlmmj-receive.in

index 5d824f962ffe6a6df3e7f44d807f9056a28e1320..f3cb823aa5c59156adf026c54b29b7a7700cc148 100644 (file)
@@ -5,6 +5,7 @@
 tests_init \
        basics \
        simple \
+       simple \
        subscribe \
        subscribe_digest \
        subscribe_nomail \
@@ -25,7 +26,8 @@ tests_init \
        normal_email \
        delheaders \
        customheaders \
-       verp
+       verp \
+       normal_email_with_dot
 
 mlmmjreceive=$(command -v mlmmj-receive)
 
@@ -2880,3 +2882,66 @@ EOF
        atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-3.txt
        atf_check -s exit:1 test -f mail-4.txt
 }
+
+normal_email_with_dot_body()
+{
+       atf_check $top_builddir/tests/fakesmtpd
+       trap kill_fakesmtp EXIT TERM
+       init_ml list
+       rmdir list/text
+       ln -s ${top_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 <<EOF
+From: bob@test
+To: test@mlmmjtest
+Return-path: bob@test
+Subject: yeah
+
+Hello
+.world
+EOF
+
+cat > nosubject <<EOF
+From: bob@test
+To: test@mlmmjtest
+Return-path: bob@test
+
+Hello
+.world
+EOF
+       atf_check -s exit:0 $mlmmjreceive -L list -F <first
+       cat >> expected-1.txt <<EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-1-user=test@mlmmjtest>\r
+RCPT TO:<user@test>\r
+DATA\r
+From: bob@test\r
+To: test@mlmmjtest\r
+Subject: yeah\r
+\r
+Hello\r
+.world\r
+\r
+.\r
+MAIL FROM:<test+bounces-1-user2=test@mlmmjtest>\r
+RCPT TO:<user2@test>\r
+DATA\r
+From: bob@test\r
+To: test@mlmmjtest\r
+Subject: yeah\r
+\r
+Hello\r
+.world\r
+\r
+.\r
+QUIT\r
+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 <first
+       atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt
+}