diff mbox

t1300: Fix test cases for non-fast-forward pushes

Message ID 20170808133202.5889-1-lfleischer@archlinux.org
State Accepted, archived
Headers show

Commit Message

Lukas Fleischer Aug. 8, 2017, 1:32 p.m. UTC
Since commit c5302d3 (Require TUs to explicitly request to overwrite a
pkgbase, 2017-07-24), non-fast-forward pushes are denied even for
Trusted Users, unless the AUR_OVERWRITE environment variable is set.
Mark the test case performing a non-fast-forward push from a TU
account as test_must_fail and add another test case performing the
same operation with AUR_OVERWRITE=1.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
---
 test/t1300-git-update.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox

Patch

diff --git a/test/t1300-git-update.sh b/test/t1300-git-update.sh
index f16e2ad..109351a 100755
--- a/test/t1300-git-update.sh
+++ b/test/t1300-git-update.sh
@@ -125,7 +125,18 @@  test_expect_success 'Performing a non-fast-forward ref update.' '
 test_expect_success 'Performing a non-fast-forward ref update as Trusted User.' '
 	old=$(git -C aur.git rev-parse HEAD) &&
 	new=$(git -C aur.git rev-parse HEAD^) &&
+	cat >expected <<-EOD &&
+	error: denying non-fast-forward (you should pull first)
+	EOD
 	AUR_USER=tu AUR_PKGBASE=foobar AUR_PRIVILEGED=1 \
+	test_must_fail "$GIT_UPDATE" refs/heads/master "$old" "$new" 2>&1 &&
+	test_cmp expected actual
+'
+
+test_expect_success 'Performing a non-fast-forward ref update with AUR_OVERWRITE=1.' '
+	old=$(git -C aur.git rev-parse HEAD) &&
+	new=$(git -C aur.git rev-parse HEAD^) &&
+	AUR_USER=tu AUR_PKGBASE=foobar AUR_PRIVILEGED=1 AUR_OVERWRITE=1 \
 	"$GIT_UPDATE" refs/heads/master "$old" "$new" 2>&1
 '