Diff options
Diffstat (limited to 'tests/t0205-config.sh')
-rwxr-xr-xtests/t0205-config.sh23
1 file changed, 8 insertions, 15 deletions
diff --git a/tests/t0205-config.sh b/tests/t0205-config.sh
index dbc73e9..f13b2ec 100755
--- a/tests/t0205-config.sh
+++ b/tests/t0205-config.sh
@@ -6,14 +6,7 @@ test_description='Check configuration diagnostics'
. ./setup.sh
test_expect_success 'set up configs' '
- {
- echo "virtual-root=/" &&
- echo "cache-size=0" &&
- echo "no-such-key=1" &&
- echo "repo.url=diag" &&
- echo "repo.path=$PWD/repos/foo/.git" &&
- echo "repo.no-such-repo-key=1"
- } >diagrc &&
+ cgitrc_repo diagrc diag no-such-key=1 "repo.path=$PWD/repos/foo/.git" repo.no-such-repo-key=1 &&
{
echo "virtual-root=/" &&
echo "cache-size=0" &&
@@ -26,14 +19,14 @@ test_expect_success 'set up configs' '
'
test_expect_success 'unknown keys are reported and the page still renders' '
- CGIT_CONFIG="$PWD/diagrc" QUERY_STRING="url=diag/" cgit >tmp 2>err &&
+ cgit_rc diagrc "url=diag/" >tmp 2>err &&
grep "Status: 200" tmp &&
grep "Unknown config key: no-such-key" err &&
grep "Unknown repo config key: no-such-repo-key" err
'
test_expect_success 'a repo key before any repo.url is reported' '
- CGIT_CONFIG="$PWD/earlyrc" QUERY_STRING="url=diag/" cgit >tmp 2>err &&
+ cgit_rc earlyrc "url=diag/" >tmp 2>err &&
grep "Status: 200" tmp &&
grep "Ignoring repo.desc before any repo.url" err
'
@@ -46,7 +39,7 @@ test_expect_success 'a filter in a scanned repository is reported without its fl
echo "cache-size=0" &&
echo "scan-path=$PWD/scan"
} >scanrc &&
- CGIT_CONFIG="$PWD/scanrc" QUERY_STRING="url=foo.git/commit/" cgit >tmp 2>err &&
+ cgit_rc scanrc "url=foo.git/commit/" >tmp 2>err &&
grep "<div class=.commit-subject.>commit 5" tmp &&
grep "Ignoring commit-filter in $PWD/scan/foo.git/: trust-scan-config is not set" err
'
@@ -56,7 +49,7 @@ test_expect_success 'the flag lets a scanned repository set its filters' '
echo "trust-scan-config=1" &&
cat scanrc
} >scanrc-on &&
- CGIT_CONFIG="$PWD/scanrc-on" QUERY_STRING="url=foo.git/commit/" cgit >tmp 2>err &&
+ cgit_rc scanrc-on "url=foo.git/commit/" >tmp 2>err &&
grep "<div class=.commit-subject.>COMMIT 5" tmp &&
! grep "Ignoring" err
'
@@ -64,7 +57,7 @@ test_expect_success 'the flag lets a scanned repository set its filters' '
# The filter prints nothing, so an empty about div shows that it ran in place
# of the readme.
test_expect_success 'a repo filter in the main cgitrc needs no flag' '
- CGIT_CONFIG="$PWD/earlyrc" QUERY_STRING="url=diag/about/" cgit >tmp 2>err &&
+ cgit_rc earlyrc "url=diag/about/" >tmp 2>err &&
grep "<div id=.about.></div>" tmp &&
! grep "about-filter" err
'
@@ -80,7 +73,7 @@ test_expect_success 'a repository whose path is missing answers 404' '
mkdir -p gone-cache &&
for page in "" log/ commit/ "tag/&h=x" atom/ plain/f
do
- CGIT_CONFIG="$PWD/gonerc" QUERY_STRING="url=gone/$page" cgit >tmp 2>err &&
+ cgit_rc gonerc "url=gone/$page" >tmp 2>err &&
grep "^Status: 404 Not Found" tmp &&
grep "Failed to open gone: No such file or directory" tmp || return 1
done &&
@@ -104,7 +97,7 @@ test_expect_success 'a NUL inside a comment does not end it' '
echo "repo.path=$PWD/repos/foo/.git"
} >nulrc &&
grep -c Smuggled nulrc &&
- CGIT_CONFIG="$PWD/nulrc" QUERY_STRING="url=" cgit >tmp &&
+ cgit_rc nulrc "url=" >tmp &&
grep "</html>" tmp &&
! grep Smuggled tmp
'