/-/auth-token as root redirects to /, closes #2375

This commit is contained in:
Simon Willison 2024-07-26 14:09:20 -07:00
commit 81b68a143a
2 changed files with 9 additions and 0 deletions

View file

@ -26,6 +26,12 @@ async def test_auth_token(ds_client):
# Check that a second with same token fails
assert ds_client.ds._root_token is None
assert (await ds_client.get(path)).status_code == 403
# But attempting with same token while logged in as root should redirect to /
response = await ds_client.get(
path, cookies={"ds_actor": ds_client.actor_cookie({"id": "root"})}
)
assert response.status_code == 302
assert response.headers["Location"] == "/"
@pytest.mark.asyncio