Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Ask for the working auth pages through cgit_ok
The unedited copy and the login page were requested through cgit_rc,
so a page cut short or an error logged on the way passed. The owner and
description checks on the login page could not fail either if the
config lost them, so the same config with a filter that lets the
visitor in now has to show both.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0505-auth.sh | 32 |
1 file changed, 19 insertions, 13 deletions
diff --git a/tests/t0505-auth.sh b/tests/t0505-auth.sh index 27b3734..ddc33d5 100755 --- a/tests/t0505-auth.sh +++ b/tests/t0505-auth.sh @@ -109,8 +109,8 @@ test_expect_success CGIT_LUA 'point cgit at the unedited auth filter' ' ' test_expect_success CGIT_LUA 'an unedited copy protects nothing' ' - cgit_url "authy/log/" >tmp && - grep ">guarded commit</a>" tmp + cgit_ok cgitrc "url=authy/log/" >tmp && + test_grep ">guarded commit</a>" tmp ' # The secret has to be one not made yet, or a host secret already readable @@ -216,26 +216,32 @@ test_expect_success 'the login page keeps the repository to itself' ' 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 "<p>sign in</p>" tmp && - grep "<p class=.sub desc.>the whole site</p>" tmp && - grep "<meta name=.description. content=.the whole site.>" tmp && - ! grep "secret plan" tmp && - ! grep "Mallory" tmp + cgit_ok denyrc "url=authy/log/" >tmp && + test_grep "<p>sign in</p>" tmp && + test_grep "<p class=.sub desc.>the whole site</p>" tmp && + test_grep "<meta name=.description. content=.the whole site.>" tmp && + test_grep ! "secret plan" tmp && + test_grep ! "Mallory" tmp && + write_script letin.sh <<-\EOF && + exit 1 + EOF + sed "s|deny.sh|letin.sh|" denyrc >letinrc && + cgit_ok letinrc "url=authy/log/" >tmp && + test_grep "secret plan" tmp && + test_grep "Mallory Owner" tmp ' # The login page answers in place of whatever page was asked for, so it is # kept out of a search index, whatever the site allows for its own pages. test_expect_success 'the login page asks not to be indexed' ' - cgit_rc denyrc "url=authy/log/" >tmp && - grep "^Status: 200" tmp && - grep "<meta name=.robots. content=.noindex, nofollow.>" tmp && + cgit_ok denyrc "url=authy/log/" >tmp && + test_grep "<meta name=.robots. content=.noindex, nofollow.>" tmp && { echo "robots=" && cat denyrc } >norobotsrc && - cgit_rc norobotsrc "url=authy/log/" >tmp && - grep "<meta name=.robots. content=.noindex, nofollow.>" tmp + cgit_ok norobotsrc "url=authy/log/" >tmp && + test_grep "<meta name=.robots. content=.noindex, nofollow.>" tmp ' test_done |
