summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-08-05 21:00:02 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-08-05 21:02:21 +0200
commit008eace8dbeb0343ae3908cb8373d669efcb8e63 (patch)
tree83af004a8957e6514b6a289423b059d412e4243b
parent3a41f8d56495e469396455b7d95e94e21e26f9b0 (diff)
downloadaurweb-008eace8dbeb0343ae3908cb8373d669efcb8e63.tar.xz
t0001: Add more git-auth tests
Test the authentication script with an invalid key type and with a key that does not exist in the database. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rw-r--r--git-interface/test/setup.sh4
-rwxr-xr-xgit-interface/test/t0001-auth.sh9
2 files changed, 13 insertions, 0 deletions
diff --git a/git-interface/test/setup.sh b/git-interface/test/setup.sh
index eecb4d5..4512978 100644
--- a/git-interface/test/setup.sh
+++ b/git-interface/test/setup.sh
@@ -54,6 +54,10 @@ AUTH_KEYTYPE_TU=ssh-rsa
AUTH_KEYTEXT_TU=AAAAB3NzaC1yc2EAAAADAQABAAABAQC4Q2Beg6jf2r1LZ4vwT5y10dK8+/c5RaNyTwv77wF2OSLXh32xW0ovhE2lW2gqoakdGsxgM2fTtqMTl29WOsAxlGF7x9XbWhFXFUT88Daq1fAeuihkiRjfBbInSW/WcrFZ+biLBch67addtfkkd4PmAafDeeCtszAXqza+ltBG1oxAGiTXgI3LOhA1/GtLLxsi5sPUO3ZlhvwDn4Sy0aXYx8l9hop/PU4Cjn82hyRa9r+SRxQ3KtjKxcVMnZ8IyXOrBwXTukgSBR/6nSdEmO0JPkYUFuNwh3UGFKuNkrPguL5T+4YDym6czYmZJzQ7NNl2pLKYmYgBwBe5rORlWfN5
AUTH_FINGERPRINT_TU=SHA256:xQGC6j/U1Q3NDXLl04pm+Shr1mjYUXbGMUzlm9vby4k
+AUTH_KEYTYPE_MISSING=sha-rsa
+AUTH_KEYTEXT_MISSING=AAAAB3NzaC1yc2EAAAADAQABAAABAQC9UTpssBunuTBCT3KFtv+yb+cN0VmI2C9O9U7wHlkEZWxNBK8is6tnDHXBxRuvRk0LHILkTidLLFX22ZF0+TFgSz7uuEvGZVNpa2Fn2+vKJJYMvZEvb/f8VHF5/Jddt21VOyu23royTN/duiT7WIZdCtEmq5C9Y43NPfsB8FbUc+FVSYT2Lq7g1/bzvFF+CZxwCrGjC3qC7p3pshICfFR8bbWgRN33ClxIQ7MvkcDtfNu38dLotJqdfEa7NdQgba5/S586f1A4OWKc/mQJFyTaGhRBxw/cBSjqonvO0442VYLHFxlrTHoUunKyOJ8+BJfKgjWmfENC9ESY3mL/IEn5
+AUTH_FINGERPRINT_MISSING=SHA256:uB0B+30r2WA1TDMUmFcaEBjosjnFGzn33XFhiyvTL9w
+
# Initialize the test database.
rm -f aur.db
sed \
diff --git a/git-interface/test/t0001-auth.sh b/git-interface/test/t0001-auth.sh
index 50ef510..71d526f 100755
--- a/git-interface/test/t0001-auth.sh
+++ b/git-interface/test/t0001-auth.sh
@@ -16,4 +16,13 @@ test_expect_success 'Test Trusted User authentication.' '
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