diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2016-10-17 15:34:21 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2016-10-17 15:34:21 +0200 |
commit | fdd932ff8d5e5899cfeae9a8b29011fa2cf9d439 (patch) | |
tree | 07afb8664e18e4d4fb479525b16db6edf026b72b /test/t2200-tuvotereminder.sh | |
parent | b091fb77580d56dbdca6424f9065581945b8e815 (diff) | |
parent | c3f464f50fb35ffb7825b90437bd912051a994ee (diff) | |
download | aur-fdd932ff8d5e5899cfeae9a8b29011fa2cf9d439.tar.gz aur-fdd932ff8d5e5899cfeae9a8b29011fa2cf9d439.tar.xz |
Merge branch 'master' into maint
Diffstat (limited to 'test/t2200-tuvotereminder.sh')
-rwxr-xr-x | test/t2200-tuvotereminder.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/t2200-tuvotereminder.sh b/test/t2200-tuvotereminder.sh new file mode 100755 index 00000000..c82ce874 --- /dev/null +++ b/test/t2200-tuvotereminder.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +test_description='tuvotereminder tests' + +. ./setup.sh + +test_expect_success 'Test Trusted User vote reminders.' ' + now=$(date -d now +%s) && + tomorrow=$(date -d tomorrow +%s) && + threedays=$(date -d "3 days" +%s) && + cat <<-EOD | sqlite3 aur.db && + INSERT INTO TU_VoteInfo (ID, Agenda, User, Submitted, End, Quorum, SubmitterID) VALUES (1, "Lorem ipsum.", "user", 0, $now, 0.00, 2); + INSERT INTO TU_VoteInfo (ID, Agenda, User, Submitted, End, Quorum, SubmitterID) VALUES (2, "Lorem ipsum.", "user", 0, $tomorrow, 0.00, 2); + INSERT INTO TU_VoteInfo (ID, Agenda, User, Submitted, End, Quorum, SubmitterID) VALUES (3, "Lorem ipsum.", "user", 0, $tomorrow, 0.00, 2); + INSERT INTO TU_VoteInfo (ID, Agenda, User, Submitted, End, Quorum, SubmitterID) VALUES (4, "Lorem ipsum.", "user", 0, $threedays, 0.00, 2); + EOD + >sendmail.out && + "$TUVOTEREMINDER" && + grep -q "Proposal 2" sendmail.out && + grep -q "Proposal 3" sendmail.out && + test_must_fail grep -q "Proposal 1" sendmail.out && + test_must_fail grep -q "Proposal 4" sendmail.out +' + +test_expect_success 'Check that only TUs who did not vote receive reminders.' ' + cat <<-EOD | sqlite3 aur.db && + INSERT INTO TU_Votes (VoteID, UserID) VALUES (1, 2); + INSERT INTO TU_Votes (VoteID, UserID) VALUES (2, 2); + INSERT INTO TU_Votes (VoteID, UserID) VALUES (3, 2); + INSERT INTO TU_Votes (VoteID, UserID) VALUES (4, 2); + INSERT INTO TU_Votes (VoteID, UserID) VALUES (1, 7); + INSERT INTO TU_Votes (VoteID, UserID) VALUES (3, 7); + INSERT INTO TU_Votes (VoteID, UserID) VALUES (2, 8); + INSERT INTO TU_Votes (VoteID, UserID) VALUES (4, 8); + INSERT INTO TU_Votes (VoteID, UserID) VALUES (1, 9); + EOD + >sendmail.out && + "$TUVOTEREMINDER" && + cat <<-EOD >expected && + Subject: TU Vote Reminder: Proposal 2 + To: tu2@localhost + Subject: TU Vote Reminder: Proposal 2 + To: tu4@localhost + Subject: TU Vote Reminder: Proposal 3 + To: tu3@localhost + Subject: TU Vote Reminder: Proposal 3 + To: tu4@localhost + EOD + grep "^\(Subject\|To\)" sendmail.out >sendmail.parts && + test_cmp sendmail.parts expected +' + +test_done |