Allowing unauthenticated users to see scopes

This commit is contained in:
Ian Roddis committed 2026-08-18 13:44:55 -03:00
1 parent 2ce4f91e4f
commit 3253d8e858
8 files changed
+136 -27

No files matched your search

+18 -6
View File
@@ -3,23 +3,35 @@ import pytest
@pytest.mark.asyncio
async def test_deep_link_redirects_to_login_with_next(client):
resp = await client.get("/scopes")
resp = await client.get("/admin/users")
assert resp.status_code == 302
assert resp.headers["location"] == "/login?next=%2Fscopes"
assert resp.headers["location"] == "/login?next=%2Fadmin%2Fusers"
@pytest.mark.asyncio
async def test_deep_link_preserves_query_string(client):
resp = await client.get("/scopes?description=alpha")
resp = await client.get("/admin/users?sort=email")
assert resp.status_code == 302
assert resp.headers["location"] == "/login?next=%2Fscopes%3Fdescription%3Dalpha"
assert resp.headers["location"] == "/login?next=%2Fadmin%2Fusers%3Fsort%3Demail"
@pytest.mark.asyncio
async def test_root_redirect_has_no_next(client):
async def test_root_redirects_anonymous_to_scopes(client):
resp = await client.get("/")
assert resp.status_code == 302
assert resp.headers["location"] == "/login"
assert resp.headers["location"] == "/scopes"
@pytest.mark.asyncio
async def test_root_renders_dashboard_when_logged_in(client, make_user):
await make_user("dash@example.com")
resp = await client.post(
"/login", data={"email": "dash@example.com", "password": "secret123"}
)
assert resp.status_code == 303
resp = await client.get("/")
assert resp.status_code == 200
assert "dash@example.com" in resp.text
@pytest.mark.asyncio