]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
add more unit tests to delheaders feature
authorErwan MAS <erwan@mas.nom.fr>
Mon, 23 Jun 2025 18:40:09 +0000 (14:40 -0400)
committerbapt <bapt@noreply.codeberg.org>
Mon, 23 Jun 2025 18:46:44 +0000 (20:46 +0200)
tests/mlmmj-receive.in

index 0168521772d00879085140477e258e4a0697ea0b..d90727e34a26e7de20babe0c3faa090041aa79d0 100644 (file)
@@ -25,6 +25,7 @@ tests_init \
        maxmailsize0 \
        normal_email \
        delheaders \
+       delheaders_extras \
        customheaders \
        customheaders_blanks \
        customheaders_with_subst \
@@ -2743,6 +2744,80 @@ EOF
        atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt
 }
 
+delheaders_extras_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 "X-k3\nx-h1\nx-L\n\n\n \n\t\nplop\nNope\n" > list/control/delheaders
+
+       printf "user@test\nuser2@test" > list/subscribers.d/u
+cat > first <<EOF
+From: bob@test
+To: test@mlmmjtest
+X-L4: plop
+X-K3: plop
+X-H2: plop
+X-H1: plop
+Received: from test.com ( mail.test.com [192.168.168.1])
+       by 192.168.168.168 with ESMTP id 0A21C400643
+       for <test@mlmmjtest>; Sat, 10 May 2025 17:17:17 +0000 (UTC)
+Received: from int.test.com ( mail.int.test.com [10.0.0.1])
+ by 192.168.168.1 with ESMTP id 0A41D900249
+ for <test@mlmmjtest>; Sat, 10 May 2025 17:16:17 +0000 (UTC)
+Return-path: bob@test
+Subject: yeah
+
+Let's go, first email
+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
+X-H2: plop\r
+Received: from test.com ( mail.test.com [192.168.168.1])\r
+       by 192.168.168.168 with ESMTP id 0A21C400643\r
+       for <test@mlmmjtest>; Sat, 10 May 2025 17:17:17 +0000 (UTC)\r
+Received: from int.test.com ( mail.int.test.com [10.0.0.1])\r
+ by 192.168.168.1 with ESMTP id 0A41D900249\r
+ for <test@mlmmjtest>; Sat, 10 May 2025 17:16:17 +0000 (UTC)\r
+Subject: yeah\r
+\r
+Let's go, first email\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
+X-H2: plop\r
+Received: from test.com ( mail.test.com [192.168.168.1])\r
+       by 192.168.168.168 with ESMTP id 0A21C400643\r
+       for <test@mlmmjtest>; Sat, 10 May 2025 17:17:17 +0000 (UTC)\r
+Received: from int.test.com ( mail.int.test.com [10.0.0.1])\r
+ by 192.168.168.1 with ESMTP id 0A41D900249\r
+ for <test@mlmmjtest>; Sat, 10 May 2025 17:16:17 +0000 (UTC)\r
+Subject: yeah\r
+\r
+Let's go, first email\r
+\r
+.\r
+QUIT\r
+EOF
+       atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt
+}
+
 customheaders_body()
 {
        atf_check $top_builddir/tests/fakesmtpd