Show padlock on private index page, refs #811

This commit is contained in:
Simon Willison 2020-06-08 07:18:37 -07:00
commit 1cf86e5ecc
3 changed files with 10 additions and 1 deletions

View file

@ -16,10 +16,16 @@ def test_view_instance(allow, expected_anon, expected_auth):
):
anon_response = client.get(path)
assert expected_anon == anon_response.status
if allow and path == "/" and anon_response.status == 200:
# Should be no padlock
assert "<h1>Datasette 🔒</h1>" not in anon_response.text
auth_response = client.get(
path, cookies={"ds_actor": client.ds.sign({"id": "root"}, "actor")},
)
assert expected_auth == auth_response.status
# Check for the padlock
if allow and path == "/" and expected_anon == 403 and expected_auth == 200:
assert "<h1>Datasette 🔒</h1>" in auth_response.text
@pytest.mark.parametrize(