From: Baptiste Daroussin Date: Thu, 28 Oct 2021 15:10:37 +0000 (+0200) Subject: mlmm-unsub: Add basic test suite X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7303a60bfac0b8cd5ef04c624fc554b8d92a369;p=thirdparty%2Fmlmmj.git mlmm-unsub: Add basic test suite --- diff --git a/tests/mlmmj-sub.sh b/tests/mlmmj-sub.sh index d4533947..c1b89f1f 100644 --- a/tests/mlmmj-sub.sh +++ b/tests/mlmmj-sub.sh @@ -6,7 +6,11 @@ tests_init \ add_normal \ add_normal_owner \ add_nomail \ - add_digest + add_digest \ + remove_normal \ + remove_normal_owner \ + remove_nomail \ + remove_digest add_normal_body() { @@ -54,3 +58,61 @@ add_nomail_body() atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -n atf_check -o inline:"john@doe.org\n" cat ml/nomailsubs.d/j } + +remove_normal_body() +{ + init_ml ml + mlmmjsub=$(command -v mlmmj-unsub) + printf "To: test@mlmmjtest1\r\nSubject: test\n\nplop" > mail + 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 + atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org + atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j + atf_check -s exit:0 $mlmmjsub -L ml -a jane@doe.org + atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j +} + +remove_normal_owner_body() +{ + init_ml ml + mlmmjsub=$(command -v mlmmj-unsub) + printf "To: test@mlmmjtest1\r\nSubject: test\n\nplop" > mail + echo 25678 > ml/control/smtpport + echo test@mlmmjtest > ml/control/listaddress + echo owner@mlmmjtest > ml/control/owner + echo "john@doe.org" > ml/subscribers.d/j + echo "bob@doe.org" >> ml/subscribers.d/j + echo "rebecca@doe.org" >> ml/subscribers.d/j + touch ml/control/notifysub + socat TCP-LISTEN:25678,bind=127.0.0.1,reuseport OPEN:output.log,creat,append & + atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org + atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j + atf_check -o inline:"MAIL FROM:\r\nRSET\r\n" cat output.log +} + +remove_digest_body() +{ + init_ml ml + mlmmjsub=$(command -v mlmmj-unsub) + printf "To: test@mlmmjtest1\r\nSubject: test\n\nplop" > mail + echo test@mlmmjtest > ml/control/listaddress + echo "john@doe.org" > ml/digesters.d/j + echo "bob@doe.org" >> ml/digesters.d/j + atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -d + atf_check -o inline:"bob@doe.org\n" cat ml/digesters.d/j +} + +remove_nomail_body() +{ + init_ml ml + mlmmjsub=$(command -v mlmmj-unsub) + printf "To: test@mlmmjtest1\r\nSubject: test\n\nplop" > mail + echo test@mlmmjtest > ml/control/listaddress + echo "john@doe.org" > ml/nomailsubs.d/j + echo "bob@doe.org" >> ml/nomailsubs.d/j + echo "rebecca@doe.org" >> ml/nomailsubs.d/j + atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -n + atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/nomailsubs.d/j +}