Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Pair each absence check with what has to be there
Every page ends in </html>, the 404 for no repositories included, and
an index, an error page or a page cut short lacks most things, so the
path-less repository, the empty url, the page without an auth filter
and the refused id each now show the page that was meant to render.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0303-robustness.sh | 29 |
1 file changed, 17 insertions, 12 deletions
diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index 65fbb53..f290609 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -34,9 +34,10 @@ test_expect_success 'a repository without a path answers 404' ' test_expect_success 'a repository without a path has no age on the index' ' mkdir -p "(null)/refs/heads" && >"(null)/refs/heads/master" && - cgit_rc nopathrc "url=" >tmp && - grep "</html>" tmp && - ! grep "<time " tmp + cgit_ok nopathrc "url=" >tmp && + test_grep ">nopath</a>" tmp && + test_grep "<td class=.col-idle.></td>" tmp && + test_grep ! "<time " tmp ' test_expect_success 'a repository with an empty url is skipped with a warning' ' @@ -52,10 +53,13 @@ test_expect_success 'a repository with an empty url is skipped with a warning' ' cgit_rc nourlrc "url=rob/" >tmp 2>err && grep "^Status: 200" tmp && grep "Ignoring repository with an empty url" err && - cgit_rc nourlrc "url=" >tmp && - ! grep nourl tmp && - cgit_rc nourlrc "r=" >tmp && - ! grep nourl tmp + for query in url= r= + do + cgit_rc nourlrc "$query" >tmp 2>err && + test_grep "^Status: 200" tmp && + test_grep ">rob</a>" tmp && + test_grep ! nourl tmp || return 1 + done ' test_expect_success 'a scan path that is itself a repository is named after it' ' @@ -701,9 +705,9 @@ test_expect_success 'pages behind an auth filter are marked private' ' grep "^Status: 200" tmp && grep "^Cache-Control: private$" tmp && grep "^Vary: Cookie$" tmp && - cgit_rc robrc "url=rob/log/" >tmp && - ! grep "^Cache-Control" tmp && - ! grep "^Vary" tmp + cgit_ok robrc "url=rob/log/" >tmp && + test_grep ! "^Cache-Control" tmp && + test_grep ! "^Vary" tmp ' # A repository without a readme sends its about page to the summary, and @@ -812,8 +816,9 @@ test_expect_success 'the error page does not resolve the id it refused' ' cgit_rc robrc "url=rob/log/&id=$sha" >tmp && grep "<title>.* @ " tmp && cgit_rc robrc "url=rob/log/&id=%3A/commit" >tmp && - grep "^Status: 400" tmp && - ! grep "<title>.* @ " tmp + test_grep "^Status: 400" tmp && + test_grep "<title>Bad Request - rob - " tmp && + test_grep ! "<title>.* @ " tmp ' # A pushed date or zone outside what git's date code accepts used to end the |
