feat: Add blacklist check for pkgbase

Also check "pkgbase" against our blacklist.

Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
moson 2024-02-17 15:55:46 +01:00
parent 057685f304
commit d050b626db
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
3 changed files with 53 additions and 0 deletions

View file

@ -536,6 +536,22 @@ test_expect_success 'Pushing a blacklisted package.' '
test_cmp expected actual
'
test_expect_success 'Pushing a blacklisted pkgbase.' '
test_when_finished "git -C aur.git checkout refs/namespaces/foobar/refs/heads/master" &&
git -C aur.git checkout -q refs/namespaces/forbidden/refs/heads/master &&
old=$(git -C aur.git rev-parse HEAD) &&
echo " " >>aur.git/.SRCINFO &&
git -C aur.git commit -q -am "Do something" &&
new=$(git -C aur.git rev-parse HEAD) &&
cat >expected <<-EOD &&
error: pkgbase is blacklisted: forbidden
EOD
test_must_fail \
env AUR_USER=user AUR_PKGBASE=forbidden AUR_PRIVILEGED=0 \
cover "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
test_cmp expected actual
'
test_expect_success 'Pushing a blacklisted package as Package Maintainer.' '
old=$(git -C aur.git rev-parse HEAD) &&
test_when_finished "git -C aur.git reset --hard $old" &&