aurweb/test/t1100-git-auth.sh
Johannes Löthberg e5b43760c2 Move AUR_OVERWRITE privilege check from git/auth to git/update
git/auth is run as an AutherizedKeysCommand which does not get the
environment variables passed to it, so AUR_OVERWRITE always got
hard-set to '0' by it.  Instead we need to perform the actual privilege
check in git/update instead.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-01-21 18:09:10 +01:00

28 lines
714 B
Bash
Executable file

#!/bin/sh
test_description='git-auth tests'
. ./setup.sh
test_expect_success 'Test basic authentication.' '
"$GIT_AUTH" "$AUTH_KEYTYPE_USER" "$AUTH_KEYTEXT_USER" >out &&
grep -q AUR_USER=user out &&
grep -q AUR_PRIVILEGED=0 out
'
test_expect_success 'Test Trusted User authentication.' '
"$GIT_AUTH" "$AUTH_KEYTYPE_TU" "$AUTH_KEYTEXT_TU" >out &&
grep -q AUR_USER=tu out &&
grep -q AUR_PRIVILEGED=1 out
'
test_expect_success 'Test authentication with an unsupported key type.' '
test_must_fail "$GIT_AUTH" ssh-xxx "$AUTH_KEYTEXT_USER"
'
test_expect_success 'Test authentication with a wrong key.' '
"$GIT_AUTH" "$AUTH_KEYTYPE_MISSING" "$AUTH_KEYTEXT_MISSING" >out
test_must_be_empty out
'
test_done