summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-10-11 07:44:21 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-10-11 22:14:41 +0200
commitfc6dc44295bed8c5d9c8014c2eab2d6bf33d2541 (patch)
tree3fe0ca49397f71530d642dacd246119bbfbbabb7 /test
parent51101d21b972b6afcef299795430cb5aea81e373 (diff)
downloadaur-fc6dc44295bed8c5d9c8014c2eab2d6bf33d2541.tar.gz
aur-fc6dc44295bed8c5d9c8014c2eab2d6bf33d2541.tar.xz
git-serve: Close orphan requests upon disown
When disowning a package base via the SSH interface, auto-accept all pending orphan requests for the affected package. Also, add a test case that checks whether (only) orphan requests belonging to disowned packages are closed correctly. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'test')
-rwxr-xr-xtest/t1200-git-serve.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/t1200-git-serve.sh b/test/t1200-git-serve.sh
index 2f1926e2..5054ce36 100755
--- a/test/t1200-git-serve.sh
+++ b/test/t1200-git-serve.sh
@@ -317,4 +317,27 @@ test_expect_success "Force-disown a package base and check (co-)maintainer list.
test_cmp expected actual
'
+test_expect_success "Check whether package requests are closed when disowning." '
+ SSH_ORIGINAL_COMMAND="adopt foobar" AUR_USER=user AUR_PRIVILEGED=0 \
+ "$GIT_SERVE" 2>&1 &&
+ cat <<-EOD | sqlite3 aur.db &&
+ INSERT INTO PackageRequests (ID, ReqTypeID, PackageBaseID, PackageBaseName, UsersID) VALUES (1, 2, 3, "foobar", 4);
+ INSERT INTO PackageRequests (ID, ReqTypeID, PackageBaseID, PackageBaseName, UsersID) VALUES (2, 3, 3, "foobar", 5);
+ INSERT INTO PackageRequests (ID, ReqTypeID, PackageBaseID, PackageBaseName, UsersID) VALUES (3, 2, 2, "foobar2", 6);
+ EOD
+ >sendmail.out &&
+ SSH_ORIGINAL_COMMAND="disown foobar" AUR_USER=user AUR_PRIVILEGED=0 \
+ "$GIT_SERVE" 2>&1 &&
+ cat <<-EOD >expected &&
+ Subject: [PRQ#1] Request Accepted
+ EOD
+ grep "^Subject.*PRQ" sendmail.out >sendmail.parts &&
+ test_cmp sendmail.parts expected &&
+ cat <<-EOD >expected &&
+ 1|2|3|foobar||4||The user user disowned the package.|0|2
+ EOD
+ echo "SELECT * FROM PackageRequests WHERE Status = 2;" | sqlite3 aur.db >actual &&
+ test_cmp actual expected
+'
+
test_done