]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
mailing+help: add testcase
authorBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 12 Apr 2023 13:25:56 +0000 (15:25 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 12 Apr 2023 13:25:56 +0000 (15:25 +0200)
src/listcontrol.c
tests/mlmmj-receive.sh

index 22453219be136aaea1fd2c61f291e561903f9380..ce755b4f8b71f8085ea8ce2f1baeb271e7bbb953 100644 (file)
@@ -268,7 +268,7 @@ int listcontrol(strlist *fromemails, struct ml *ml,
                        log_error(LOG_ARGS, "A subscribe-both request was"
                                " denied");
                        txt = open_text(ml->fd, "deny", "sub", "disabled",
-                                       "both", "sub-deny-digest");
+                               "both", "sub-deny-digest");
                        MY_ASSERT(txt);
                        register_default_unformatted(txt, ml);
                        register_unformatted(txt, "subaddr",
index 3800038881d146cb81985d3e505e720ce444cb68..16713a50abd0093543d671e2afa8bf32919128e1 100755 (executable)
@@ -11,7 +11,8 @@ tests_init \
        subscribe_nomail_confunsub \
        subscribe_digest_confunsub \
        subscribe_both \
-       ctrl_list
+       ctrl_list \
+       ctrl_help
 
 mlmmjreceive=$(command -v mlmmj-receive)
 
@@ -1453,3 +1454,71 @@ EOF
        atf_check $mlmmjreceive -L list -F <ctrllist
        atf_check -s exit:1 test -f mail-3.txt
 }
+
+ctrl_help_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
+
+       cat > ctrlhelp << EOF
+From: bob@test
+To: test+help@mlmmjtest
+Return-Path: jane@test
+EOF
+
+cat > expected-1.txt << EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-help@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Information_for_test=40mlmmjtest?=\r
+From: test+owner@mlmmjtest\r
+To: bob@test\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
+Here is some information about the list.\r
+\r
+You can subscribe to the following versions:\r
+\r
+- The normal version: Every time a post is sent to the list, subscribers\r
+  receive a copy of it. Subscribe by emailing <test+subscribe@mlmmjtest>.\r
+\r
+- The digest version: Subscribers receive multiple posts in a single mail\r
+  message, at regular intervals, or when a lot of posts have accumulated.\r
+  Subscribe by emailing <test+subscribe-digest@mlmmjtest>.\r
+\r
+- The no-mail version: Subscribers do not receive any posts to the list.\r
+  This means, though, they are able to post to a list which only\r
+  subscribers may post to, while they follow the list using a web archive\r
+  or another subscribed email address. Subscribe by emailing\r
+  <test+subscribe-nomail@mlmmjtest>.\r
+\r
+Unsubscribe by emailing <test+unsubscribe@mlmmjtest>.\r
+\r
+Posts are made by emailing <test@mlmmjtest>.\r
+\r
+Subscribers can retrieve message number N from the list's archive by\r
+sending a message to <test+get-N@mlmmjtest> (change the N to the number of\r
+the desired message).\r
+\r
+You can retrieve the frequently asked questions document for the list by\r
+sending a message to <test+faq@mlmmjtest>.\r
+\r
+To contact the list owner, send a message to <test+owner@mlmmjtest>.\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+       atf_check $mlmmjreceive -L list -F <ctrlhelp
+       atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-1.txt
+}