summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-11-13 15:39:55 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2016-11-13 15:40:34 +0100
commit9dd0d92d61462860089f479e0f0f6cd957a3ec04 (patch)
treef0e83430fe04e3be9c29215fec5f98c6b644f55f /test
parente9ac4b9b9ee797a1a0c09e9c3b14ae7d498ea8ea (diff)
downloadaur-9dd0d92d61462860089f479e0f0f6cd957a3ec04.tar.gz
aur-9dd0d92d61462860089f479e0f0f6cd957a3ec04.tar.xz
Add tests for out-of-date notifications
Make sure that out-of-date notifications are sent to package base maintainers as well as co-maintainers. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'test')
-rwxr-xr-xtest/t2500-notify.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/t2500-notify.sh b/test/t2500-notify.sh
new file mode 100755
index 00000000..1b209458
--- /dev/null
+++ b/test/t2500-notify.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+test_description='notify tests'
+
+. ./setup.sh
+
+test_expect_success 'Test out-of-date notifications.' '
+ cat <<-EOD | sqlite3 aur.db &&
+ INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS) VALUES (1, "foobar", 1, 0, 0);
+ INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS) VALUES (2, "foobar2", 2, 0, 0);
+ INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS) VALUES (3, "foobar3", NULL, 0, 0);
+ INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS) VALUES (4, "foobar4", 1, 0, 0);
+ INSERT INTO PackageComaintainers (PackageBaseID, UsersID, Priority) VALUES (1, 2, 1);
+ INSERT INTO PackageComaintainers (PackageBaseID, UsersID, Priority) VALUES (1, 4, 2);
+ INSERT INTO PackageComaintainers (PackageBaseID, UsersID, Priority) VALUES (2, 3, 1);
+ INSERT INTO PackageComaintainers (PackageBaseID, UsersID, Priority) VALUES (2, 5, 2);
+ INSERT INTO PackageComaintainers (PackageBaseID, UsersID, Priority) VALUES (3, 4, 1);
+ EOD
+ >sendmail.out &&
+ "$NOTIFY" flag 1 1 &&
+ cat <<-EOD >expected &&
+ Subject: AUR Out-of-date Notification for foobar
+ To: tu@localhost
+ Subject: AUR Out-of-date Notification for foobar
+ To: user2@localhost
+ Subject: AUR Out-of-date Notification for foobar
+ To: user@localhost
+ EOD
+ grep "^\(Subject\|To\)" sendmail.out >sendmail.parts &&
+ test_cmp sendmail.parts expected
+'
+
+test_done