|
@@ -1,98 +1,6 @@
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
set -euo pipefail
|
|
set -euo pipefail
|
|
-export DEBUG=1
|
|
|
|
-export TEST=1
|
|
|
|
-MAILDROPDIR=$(mktemp -d)
|
|
|
|
-cleanup (){
|
|
|
|
- rm -rf "$MAILDROPDIR"
|
|
|
|
-}
|
|
|
|
-trap cleanup EXIT
|
|
|
|
|
|
|
|
-export MAILDROPDIR
|
|
|
|
-
|
|
|
|
-SCRIPTDIR=$(readlink -e "${BASH_SOURCE[0]%/*}")
|
|
|
|
-cd "$MAILDROPDIR"
|
|
|
|
-
|
|
|
|
-#
|
|
|
|
-# TEST cropswap@shandan.one
|
|
|
|
-mkdir cropswap@shandan.one
|
|
|
|
-${SCRIPTDIR}/cropswap-register.sh cropswap@shandan.one "Member" "member1@mail.com" &>/dev/null
|
|
|
|
-${SCRIPTDIR}/cropswap-register.sh cropswap@shandan.one "Member" "member2@mail.com" &>/dev/null
|
|
|
|
-${SCRIPTDIR}/cropswap-postmaster.sh SIGNUP cropswap@shandan.one organizer1@mail.com <<EOF &>/dev/null
|
|
|
|
-X-MEMBER-ALIAS: Organizer
|
|
|
|
-X-AUTH: admin
|
|
|
|
-EOF
|
|
|
|
-${SCRIPTDIR}/cropswap-postmaster.sh SUBSCRIBE cropswap@shandan.one organizer1@mail.com &>/dev/null
|
|
|
|
-${SCRIPTDIR}/cropswap-postmaster.sh SIGNUP cropswap@shandan.one organizer2@mail.com <<EOF &>/dev/null
|
|
|
|
-X-MEMBER-ALIAS: Organizer
|
|
|
|
-X-AUTH: admin
|
|
|
|
-EOF
|
|
|
|
-${SCRIPTDIR}/cropswap-postmaster.sh SUBSCRIBE cropswap@shandan.one organizer2@mail.com &>/dev/null
|
|
|
|
-
|
|
|
|
-set -x
|
|
|
|
-maildrop -funregistered@mail.com < ${SCRIPTDIR}/tests/cropswap@shandan.one/from-unregistered.eml 1>forward.out 2>forward.err
|
|
|
|
-grep '^From: A. Person <unregistered@mail.com>$' < forward.out
|
|
|
|
-grep '^To: A. Person <unregistered@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Organizer <organizer1@mail.com>$' < forward.out
|
|
|
|
-grep '^To: Organizer 1 <organizer2@mail.com>$' < forward.out
|
|
|
|
-grep '^To: Member <member1@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Member 1 <member2@mail.com>$' < forward.out && false
|
|
|
|
-grep '^Subject: \[Crop Swap Query\] .*$' < forward.out
|
|
|
|
-
|
|
|
|
-maildrop -fmember1@mail.com < ${SCRIPTDIR}/tests/cropswap@shandan.one/from-member.eml 1>forward.out 2>forward.err
|
|
|
|
-grep '^From: Member <cropswap@shandan.one>$' < forward.out
|
|
|
|
-grep '^To: Member <member1@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Organizer <organizer1@mail.com>$' < forward.out
|
|
|
|
-grep '^To: Organizer 1 <organizer2@mail.com>$' < forward.out
|
|
|
|
-grep '^Subject: \[Crop Swap Query\] .*$' < forward.out
|
|
|
|
-
|
|
|
|
-maildrop -forganizer1@mail.com < ${SCRIPTDIR}/tests/cropswap@shandan.one/from-organizer-to-member.eml 1>forward.out 2>forward.err
|
|
|
|
-grep '^From: Organizer <cropswap@shandan.one>$' < forward.out
|
|
|
|
-grep '^To: Organizer <organizer1@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Organizer 1 <organizer2@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Member <member1@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Member 1 <member2@mail.com>$' < forward.out
|
|
|
|
-grep '^Subject: \[Crop Swap Notice\] .*$' < forward.out
|
|
|
|
-
|
|
|
|
-maildrop -forganizer2@mail.com < ${SCRIPTDIR}/tests/cropswap@shandan.one/from-organizer.eml 1>forward.out 2>forward.err
|
|
|
|
-grep '^From: Organizer 1 <cropswap@shandan.one>$' < forward.out
|
|
|
|
-grep '^To: Organizer 1 <organizer2@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Organizer <organizer1@mail.com>$' < forward.out
|
|
|
|
-grep '^To: Member <member1@mail.com>$' < forward.out
|
|
|
|
-grep '^To: Member 1 <member2@mail.com>$' < forward.out
|
|
|
|
-grep '^Subject: \[Crop Swap Notice\] .*$' < forward.out
|
|
|
|
-set +x
|
|
|
|
-
|
|
|
|
-#
|
|
|
|
-# TEST cropswap-members@shandan.one
|
|
|
|
-mkdir cropswap-members@shandan.one
|
|
|
|
-${SCRIPTDIR}/cropswap-register.sh cropswap-members@shandan.one "Member" "member1@mail.com" &>/dev/null
|
|
|
|
-${SCRIPTDIR}/cropswap-register.sh cropswap-members@shandan.one "Member" "member2@mail.com" &>/dev/null
|
|
|
|
-${SCRIPTDIR}/cropswap-register.sh cropswap-members@shandan.one "Organizer" "organizer1@mail.com" &>/dev/null
|
|
|
|
-${SCRIPTDIR}/cropswap-register.sh cropswap-members@shandan.one "Organizer" "organizer2@mail.com" &>/dev/null
|
|
|
|
-
|
|
|
|
-set -x
|
|
|
|
-maildrop -funregistered@mail.com < ${SCRIPTDIR}/tests/cropswap-members@shandan.one/from-unregistered.eml 1>forward.out 2>forward.err
|
|
|
|
-grep '^From: A. Person <unregistered@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: A. Person <unregistered@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Organizer <organizer1@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Organizer 1 <organizer2@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Member <member1@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Member 1 <member2@mail.com>$' < forward.out && false
|
|
|
|
-grep '^Subject: \[Crop Swap Query\] .*$' < forward.out && false
|
|
|
|
-
|
|
|
|
-maildrop -fmember1@mail.com < ${SCRIPTDIR}/tests/cropswap-members@shandan.one/from-member.eml 1>forward.out 2>forward.err
|
|
|
|
-grep '^From: Member <cropswap-members@shandan.one>$' < forward.out
|
|
|
|
-grep '^To: Member <member1@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Organizer <organizer1@mail.com>$' < forward.out
|
|
|
|
-grep '^To: Organizer 1 <organizer2@mail.com>$' < forward.out
|
|
|
|
-grep '^To: Member 1 <member2@mail.com>$' < forward.out
|
|
|
|
-grep '^Subject: \[Crop Swap Member\] .*$' < forward.out
|
|
|
|
-
|
|
|
|
-maildrop -forganizer1@mail.com < ${SCRIPTDIR}/tests/cropswap-members@shandan.one/from-member-to-member.eml 1>forward.out 2>forward.err
|
|
|
|
-grep '^From: Organizer <cropswap-members@shandan.one>$' < forward.out
|
|
|
|
-grep '^To: Organizer <organizer1@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Organizer 1 <organizer2@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Member <member1@mail.com>$' < forward.out && false
|
|
|
|
-grep '^To: Member 1 <member2@mail.com>$' < forward.out
|
|
|
|
-grep '^Subject: \[Crop Swap Member\] .*$' < forward.out
|
|
|
|
|
|
+./test-signup.sh
|
|
|
|
+./test-cropswap@shandan.one.sh
|
|
|
|
+./test-cropswap-members@shandan.one.sh
|