summaryrefslogtreecommitdiffstats
path: root/git-interface/test/setup.sh
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-08-05 14:01:22 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-08-05 21:23:20 +0200
commitdd9c6f3ddca37479ce14425c0a82a4b46d7a727a (patch)
tree8c86ac884408a842e4b4785d9b337c5016783205 /git-interface/test/setup.sh
parent9a03c7fbdd9a1eff197d9c14301ab23aabc88109 (diff)
downloadaur-dd9c6f3ddca37479ce14425c0a82a4b46d7a727a.tar.gz
aur-dd9c6f3ddca37479ce14425c0a82a4b46d7a727a.tar.xz
t0003: Add more git-update tests
Add tests for common scenarios that should be detected/handled by the update hook. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'git-interface/test/setup.sh')
-rw-r--r--git-interface/test/setup.sh68
1 files changed, 57 insertions, 11 deletions
diff --git a/git-interface/test/setup.sh b/git-interface/test/setup.sh
index cb1e2506..7f3d45a1 100644
--- a/git-interface/test/setup.sh
+++ b/git-interface/test/setup.sh
@@ -90,20 +90,23 @@ echo "INSERT INTO Users (ID, UserName, Passwd, Email, AccountTypeID) VALUES (2,
echo "INSERT INTO SSHPubKeys (UserID, Fingerprint, PubKey) VALUES (1, '$AUTH_FINGERPRINT_USER', '$AUTH_KEYTYPE_USER $AUTH_KEYTEXT_USER');" | sqlite3 aur.db
echo "INSERT INTO SSHPubKeys (UserID, Fingerprint, PubKey) VALUES (2, '$AUTH_FINGERPRINT_TU', '$AUTH_KEYTYPE_TU $AUTH_KEYTEXT_TU');" | sqlite3 aur.db
-# Initialize a Git repository to store test packages in.
-(
- GIT_AUTHOR_EMAIL=author@example.com
- GIT_AUTHOR_NAME='A U Thor'
- GIT_COMMITTER_EMAIL=committer@example.com
- GIT_COMMITTER_NAME='C O Mitter'
- export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
- export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
+echo "INSERT INTO PackageBlacklist (Name) VALUES ('forbidden');" | sqlite3 aur.db
+echo "INSERT INTO OfficialProviders (Name, Repo, Provides) VALUES ('official', 'core', 'official');" | sqlite3 aur.db
+
+# Initialize a Git repository and test packages.
+GIT_AUTHOR_EMAIL=author@example.com
+GIT_AUTHOR_NAME='A U Thor'
+GIT_COMMITTER_EMAIL=committer@example.com
+GIT_COMMITTER_NAME='C O Mitter'
+export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
+export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
+(
mkdir aur.git
cd aur.git
-
git init -q
- git checkout -q -b refs/namespaces/foobar/refs/heads/master
+
+ git checkout -q --orphan refs/namespaces/foobar/refs/heads/master
cat >PKGBUILD <<-EOF
pkgname=foobar
@@ -136,5 +139,48 @@ echo "INSERT INTO SSHPubKeys (UserID, Fingerprint, PubKey) VALUES (2, '$AUTH_FIN
EOF
git add PKGBUILD .SRCINFO
- git commit -q -am 'Initial import'
+ git commit -q -m 'Initial import'
+
+ sed 's/\(pkgrel.*\)1/\12/' PKGBUILD >PKGBUILD.new
+ sed 's/\(pkgrel.*\)1/\12/' .SRCINFO >.SRCINFO.new
+ mv PKGBUILD.new PKGBUILD
+ mv .SRCINFO.new .SRCINFO
+ git commit -q -am 'Bump pkgrel'
+
+ git checkout -q --orphan refs/namespaces/foobar2/refs/heads/master
+
+ cat >PKGBUILD <<-EOF
+ pkgname=foobar2
+ pkgver=1
+ pkgrel=1
+ pkgdesc='aurweb test package.'
+ url='https://aur.archlinux.org/'
+ license=('MIT')
+ arch=('any')
+ depends=('python-pygit2')
+ source=()
+ md5sums=()
+
+ package() {
+ echo 'Hello world!'
+ }
+ EOF
+
+ cat >.SRCINFO <<-EOF
+ pkgbase = foobar2
+ pkgdesc = aurweb test package.
+ pkgver = 1
+ pkgrel = 1
+ url = https://aur.archlinux.org/
+ arch = any
+ license = MIT
+ depends = python-pygit2
+
+ pkgname = foobar2
+ EOF
+
+ git add PKGBUILD .SRCINFO
+ git commit -q -m 'Initial import'
+
+ git checkout -q refs/namespaces/foobar/refs/heads/master
)