mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Logout link in nav, refs #875
This commit is contained in:
parent
51427323e6
commit
2115d7e345
7 changed files with 73 additions and 2 deletions
|
|
@ -78,3 +78,17 @@ def test_logout(app_client):
|
|||
# Should also have set a message
|
||||
messages = app_client.ds.unsign(response4.cookies["ds_messages"], "messages")
|
||||
assert [["You are now logged out", 2]] == messages
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", ["/", "/fixtures", "/fixtures/facetable"])
|
||||
def test_logout_button_in_navigation(app_client, path):
|
||||
response = app_client.get(
|
||||
path, cookies={"ds_actor": app_client.actor_cookie({"id": "test"})}
|
||||
)
|
||||
anon_response = app_client.get(path)
|
||||
for fragment in (
|
||||
"<strong>test</strong> ·",
|
||||
'<form action="/-/logout" method="post">',
|
||||
):
|
||||
assert fragment in response.text
|
||||
assert fragment not in anon_response.text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue