From: Baptiste Daroussin Date: Fri, 17 Feb 2023 22:26:34 +0000 (+0100) Subject: mlmmj-unsub: test unsubscription mail sent X-Git-Tag: RELEASE_1_4_0b1~99 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ea5f5c974958344b5aa3b544f3ce8c271f18064;p=thirdparty%2Fmlmmj.git mlmmj-unsub: test unsubscription mail sent --- diff --git a/tests/mlmmj-sub.sh b/tests/mlmmj-sub.sh index d79d1b36..b50633fe 100755 --- a/tests/mlmmj-sub.sh +++ b/tests/mlmmj-sub.sh @@ -26,6 +26,7 @@ tests_init \ add_nomail_with_both \ remove_basics \ remove_normal \ + remove_normal_confirm \ remove_normal_owner \ remove_nomail \ remove_digest @@ -383,6 +384,124 @@ remove_normal_body() atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j } +remove_normal_confirm_body() +{ + init_ml ml + mlmmjsub=$(command -v mlmmj-unsub) + atf_check $srcdir/fakesmtpd + trap kill_fakesmtp EXIT TERM + echo test@mlmmjtest > ml/control/listaddress + echo "john@doe.org" > ml/subscribers.d/j + echo "bob@doe.org" >> ml/subscribers.d/j + echo "rebecca@doe.org" >> ml/subscribers.d/j + echo "25678" > ml/control/smtpport + echo "heloname" > ml/control/smtphelo + rmdir ml/text + ln -s ${srcdir}/../listtexts/en ml/text + atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org + atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j + cat > expected.txt << EOF +EHLO heloname +MAIL FROM: +RCPT TO: +DATA +Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= +From: test+help@mlmmjtest +To: john@doe.org +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Hi, this is the Mlmmj program managing the mailing list. + +An administrator has removed you from the list. + + +. +QUIT +EOF + atf_check -s exit:1 test -f mail-2.txt + atf_check -o file:expected.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-1.txt + touch ml/control/notifysub + atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org + atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j + cat > expected2.txt << EOF +EHLO heloname +MAIL FROM: +RCPT TO: +DATA +Subject: =?utf-8?q?Unable_to_unsubscribe_from_test=40mlmmjtest?= +From: test+help@mlmmjtest +To: john@doe.org +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Hi, this is the Mlmmj program managing the mailing list. + +You were unable to be unsubscribed from the list because you are not +subscribed. + +If you are receiving messages, perhaps a different email address is +subscribed. To find out which address you are subscribed with, refer to the +message welcoming you to the list, or look at the envelope "Return-Path" +header of a message you receive from the list. + + +. +QUIT +EOF + atf_check -o file:expected2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt + + echo "john@doe.org" >> ml/subscribers.d/j + atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org + atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j + cat > expected3.txt << EOF +EHLO heloname +MAIL FROM: +RCPT TO: +DATA +Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= +From: test+help@mlmmjtest +To: john@doe.org +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Hi, this is the Mlmmj program managing the mailing list. + +An administrator has removed you from the list. + + +. +QUIT +EOF + atf_check -o file:expected3.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-3.txt + cat > expected4.txt << EOF +EHLO heloname +MAIL FROM: +RCPT TO: +DATA +Subject: =?utf-8?q?Unsubscribed_from_test=40mlmmjtest:_john=40doe.org?= +From: test+owner@mlmmjtest +To: test+owner@mlmmjtest +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Hi, this is the Mlmmj program managing the mailing list. + +The address has been unsubscribed from the list because an +administrator commanded it. + + +. +QUIT +EOF + atf_check -o file:expected4.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-4.txt + atf_check -s exit:1 test -f mail-5.txt +} + remove_normal_owner_body() { init_ml ml