aurweb/test/t2200-tuvotereminder.sh
Lukas Fleischer eb367d97e2 Use the notify script in tests
Instead of only checking whether the notification script is called with
the correct parameters, actually invoke the real notify script and check
whether proper notifications are generated.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-09-29 22:07:24 +02:00

25 lines
1 KiB
Bash
Executable file

#!/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_done