summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-09-21 09:13:49 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-09-29 22:07:24 +0200
commitd00f4c5197652563a61628461a39fd799264c9c4 (patch)
tree2c57140c9d79274b63c7700da8e8c62c857089ce /test
parent91f649f5edaae42f616ad9fc2facb90f1d71f9b9 (diff)
downloadaur-d00f4c5197652563a61628461a39fd799264c9c4.tar.gz
aur-d00f4c5197652563a61628461a39fd799264c9c4.tar.xz
Add tests for pkgmaint
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'test')
-rw-r--r--test/setup.sh1
-rwxr-xr-xtest/t2300-pkgmaint.sh26
2 files changed, 27 insertions, 0 deletions
diff --git a/test/setup.sh b/test/setup.sh
index e6a9a16f..622aab03 100644
--- a/test/setup.sh
+++ b/test/setup.sh
@@ -13,6 +13,7 @@ GIT_SERVE="$TOPLEVEL/git-interface/git-serve.py"
GIT_UPDATE="$TOPLEVEL/git-interface/git-update.py"
MKPKGLISTS="$TOPLEVEL/scripts/mkpkglists.py"
TUVOTEREMINDER="$TOPLEVEL/scripts/tuvotereminder.py"
+PKGMAINT="$TOPLEVEL/scripts/pkgmaint.py"
# Create the configuration file and a dummy notification script.
cat >config <<-EOF
diff --git a/test/t2300-pkgmaint.sh b/test/t2300-pkgmaint.sh
new file mode 100755
index 00000000..5c55aaf1
--- /dev/null
+++ b/test/t2300-pkgmaint.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+test_description='pkgmaint tests'
+
+. ./setup.sh
+
+test_expect_success 'Test package base cleanup script.' '
+ now=$(date -d now +%s) &&
+ threedaysago=$(date -d "3 days ago" +%s) &&
+ cat <<-EOD | sqlite3 aur.db &&
+ INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (1, "foobar", 1, $now, 0);
+ INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (2, "foobar2", 2, $threedaysago, 0);
+ INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (3, "foobar3", NULL, $now, 0);
+ INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (4, "foobar4", NULL, $threedaysago, 0);
+ EOD
+ "$PKGMAINT" &&
+ cat <<-EOD >expected &&
+ foobar
+ foobar2
+ foobar3
+ EOD
+ echo "SELECT Name FROM PackageBases;" | sqlite3 aur.db >actual &&
+ test_cmp actual expected
+'
+
+test_done