]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
mlmmj-sub: add a test for notifysub
authorBaptiste Daroussin <bapt@FreeBSD.org>
Mon, 6 Mar 2023 13:19:19 +0000 (14:19 +0100)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Mon, 6 Mar 2023 13:19:19 +0000 (14:19 +0100)
tests/mlmmj-sub.sh

index c8556ea7cddfef1531e81934833997e52982e380..90ffcea0c8952448d1a42d23ce164e6104b3f837 100755 (executable)
@@ -13,6 +13,7 @@ tests_init \
        add_normal \
        add_normal_welcome \
        add_normal_welcome_confirm \
+       add_normal_welcome_confirm_and_send_owner \
        add_normal_welcome_moderate \
        add_normal_owner \
        add_nomail \
@@ -143,6 +144,76 @@ EOF
        atf_check -s exit:1 test -f mail-2.txt
 }
 
+add_normal_welcome_confirm_and_send_owner_body()
+{
+       init_ml ml
+       mlmmjsub=$(command -v mlmmj-sub)
+       atf_check $srcdir/fakesmtpd
+       trap kill_fakesmtp EXIT TERM
+       echo test@mlmmjtest > ml/control/listaddress
+       echo "25678" > ml/control/smtpport
+       echo "heloname" > ml/control/smtphelo
+       touch ml/control/notifysub
+       rmdir ml/text
+       ln -s ${srcdir}/../listtexts/en ml/text
+       atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org
+       cat > expected.txt <<EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-help@mlmmjtest>\r
+RCPT TO:<john@doe.org>\r
+DATA\r
+Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?=\r
+From: test+help@mlmmjtest\r
+To: john@doe.org\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+An administrator has subscribed you to the normal version of the list.\r
+\r
+The email address you are subscribed with is <john@doe.org>.\r
+\r
+If you ever wish to unsubscribe, send a message to\r
+<test+unsubscribe@mlmmjtest> using this email address. The subject and the\r
+body of the message can be anything. You will then receive confirmation or\r
+further instructions.\r
+\r
+For other information and help about this list, send a message to\r
+<test+help@mlmmjtest>.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+
+       atf_check -o file:expected.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-.*@mlmmjtest/confsub-@mlmmjtest/g" mail-1.txt
+       cat > expected2.txt <<EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-help@mlmmjtest>\r
+RCPT TO:<test+owner@mlmmjtest>\r
+DATA\r
+Subject: =?utf-8?q?Subscribed_to_test=40mlmmjtest:_john=40doe.org?=\r
+From: test+owner@mlmmjtest\r
+To: test+owner@mlmmjtest\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+The address <john@doe.org> has been subscribed to the normal version of the\r
+list because an administrator commanded it.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+       atf_check -o file:expected2.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-.*@mlmmjtest/confsub-@mlmmjtest/g" mail-2.txt
+       atf_check -s exit:1 test -f mail-3.txt
+}
+
 add_normal_welcome_moderate_body()
 {
        init_ml ml