From 23433c85c076a013f4a95e096f344a0117470905 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 15:14:32 -1000 Subject: Write the auth test configs through cgitrc_repo --- tests/t0505-auth.sh | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) (limited to 'tests') diff --git a/tests/t0505-auth.sh b/tests/t0505-auth.sh index ae5e299..3b45dd3 100755 --- a/tests/t0505-auth.sh +++ b/tests/t0505-auth.sh @@ -102,13 +102,7 @@ then fi test_expect_success CGIT_LUA 'point cgit at the unedited auth filter' ' - cat >cgitrc <<-EOF - virtual-root=/ - cache-size=0 - auth-filter=lua:$EXTENSIONS_DIRECTORY/auth-inline.lua - repo.url=authy - repo.path=$PWD/repos/authy/.git - EOF + cgitrc_repo cgitrc authy "auth-filter=lua:$EXTENSIONS_DIRECTORY/auth-inline.lua" ' test_expect_success CGIT_LUA 'an unedited copy protects nothing' ' @@ -127,13 +121,7 @@ test_expect_success CGIT_LUA_NOAUTH 'without the modules a protected repository awk -v secret="$PWD/guarded-secret" -f protect.awk "$EXTENSIONS_DIRECTORY/auth-inline.lua" >guarded.lua && grep "\"authy\"" guarded.lua && grep "guarded-secret" guarded.lua && - cat >guardedrc <<-EOF && - virtual-root=/ - cache-size=0 - auth-filter=lua:$PWD/guarded.lua - repo.url=authy - repo.path=$PWD/repos/authy/.git - EOF + cgitrc_repo guardedrc authy "auth-filter=lua:$PWD/guarded.lua" && cgit_rc guardedrc "url=authy/log/" >tmp 2>err && ! grep "guarded commit" tmp && grep "

Logins are unavailable" tmp && @@ -223,17 +211,8 @@ test_expect_success 'the login page keeps the repository to itself' ' test "$1" = body && echo "

sign in

" exit 0 EOF - cat >denyrc <<-EOF && - virtual-root=/ - cache-size=0 - root-desc=the whole site - auth-filter=exec:$PWD/deny.sh - repo.url=authy - repo.path=$PWD/repos/authy/.git - repo.desc=the secret plan - repo.owner=Mallory Owner - repo.hide=1 - EOF + cgitrc_repo denyrc authy "root-desc=the whole site" "auth-filter=exec:$PWD/deny.sh" \ + "repo.desc=the secret plan" "repo.owner=Mallory Owner" "repo.hide=1" && cgit_rc denyrc "url=authy/log/" >tmp && grep "

sign in

" tmp && grep "

the whole site

" tmp && -- cgit 2.12.1