summaryrefslogtreecommitdiffstats
path: root/git-interface/test/t0003-update.sh
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-08-04 20:36:31 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-08-05 12:12:09 +0200
commit6e38309c194d860cccd26f901ee5687502331779 (patch)
tree53b70a6444cbe07e60466b7cd4783a7879b8653a /git-interface/test/t0003-update.sh
parent5014b74868138172090e7528f1b069642e15f295 (diff)
downloadaur-6e38309c194d860cccd26f901ee5687502331779.tar.gz
aur-6e38309c194d860cccd26f901ee5687502331779.tar.xz
git-interface: Add test suite and basic tests
Add basic tests for the Git interface. The test suite is based on sharness. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'git-interface/test/t0003-update.sh')
-rwxr-xr-xgit-interface/test/t0003-update.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/git-interface/test/t0003-update.sh b/git-interface/test/t0003-update.sh
new file mode 100755
index 00000000..0e8962c1
--- /dev/null
+++ b/git-interface/test/t0003-update.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+test_description='git-update tests'
+
+. ./setup.sh
+
+test_expect_success 'Test update hook.' '
+ old=0000000000000000000000000000000000000000 &&
+ new=$(git -C aur.git rev-parse HEAD) &&
+ SSH_ORIGINAL_COMMAND="setup-repo foobar" AUR_USER=user "$GIT_SERVE" &&
+ AUR_USER=user AUR_PKGBASE=foobar AUR_PRIVILEGED=0 \
+ "$GIT_UPDATE" refs/heads/master "$old" "$new" 2>&1 &&
+ cat >expected <<-EOF &&
+ 1|1|foobar|1-1|aurweb test package.|https://aur.archlinux.org/
+ EOF
+ echo "SELECT * FROM Packages;" | sqlite3 aur.db >actual &&
+ test_cmp expected actual
+'
+
+test_done