summaryrefslogtreecommitdiffstats
path: root/test/t1200-git-serve.sh
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2017-01-25 18:27:06 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2017-01-25 18:42:34 +0100
commit33095b3292bdb2fa5561bf257c86004eeddcfae9 (patch)
treea15f2ce4bad1cdd98b35c9ae32053db1d62bd3ec /test/t1200-git-serve.sh
parent0e34dd6542afecc0890f77fbcb497fb5d8690d5b (diff)
downloadaur-33095b3292bdb2fa5561bf257c86004eeddcfae9.tar.gz
aur-33095b3292bdb2fa5561bf257c86004eeddcfae9.tar.xz
t1200: Test IP address log and bans
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'test/t1200-git-serve.sh')
-rwxr-xr-xtest/t1200-git-serve.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/t1200-git-serve.sh b/test/t1200-git-serve.sh
index f986b625..07383aff 100755
--- a/test/t1200-git-serve.sh
+++ b/test/t1200-git-serve.sh
@@ -31,6 +31,27 @@ test_expect_success 'Test maintenance mode.' '
mv config.old config
'
+test_expect_success 'Test IP address logging.' '
+ SSH_ORIGINAL_COMMAND=help AUR_USER=user "$GIT_SERVE" 2>actual &&
+ cat >expected <<-EOF &&
+ 1.2.3.4
+ EOF
+ echo "SELECT LastSSHLoginIPAddress FROM Users WHERE UserName = \"user\";" | \
+ sqlite3 aur.db >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'Test IP address bans.' '
+ SSH_CLIENT_ORIG="$SSH_CLIENT" &&
+ SSH_CLIENT="1.3.3.7 1337 22" &&
+ SSH_ORIGINAL_COMMAND=help test_must_fail "$GIT_SERVE" 2>actual &&
+ cat >expected <<-EOF &&
+ The SSH interface is disabled for your IP address.
+ EOF
+ test_cmp expected actual &&
+ SSH_CLIENT="$SSH_CLIENT_ORIG"
+'
+
test_expect_success 'Test setup-repo and list-repos.' '
SSH_ORIGINAL_COMMAND="setup-repo foobar" AUR_USER=user \
"$GIT_SERVE" 2>&1 &&