test: update existing tests to handle consent step
This commit is contained in:
parent
078892a413
commit
b8464284c2
3 changed files with 28 additions and 7 deletions
|
|
@ -59,6 +59,8 @@ async def _get_authorization_code(client: AsyncClient) -> str:
|
|||
"""Run full auth flow and extract the authorization code."""
|
||||
_register_test_client(client)
|
||||
|
||||
app = client._transport.app # type: ignore[union-attr]
|
||||
|
||||
# Start authorization (unauthenticated — stores in session)
|
||||
await client.get(
|
||||
"/authorization",
|
||||
|
|
@ -74,9 +76,13 @@ async def _get_authorization_code(client: AsyncClient) -> str:
|
|||
)
|
||||
|
||||
# Create user and log in
|
||||
await _create_user_and_login(client)
|
||||
userid = await _create_user_and_login(client)
|
||||
|
||||
# Complete authorization (now authenticated, session has oidc_auth_request)
|
||||
# Pre-seed consent so the consent screen is skipped
|
||||
consent_repo = app.state.consent_repo
|
||||
await consent_repo.set_consent(userid, "test-rp", ["openid", "profile", "email"])
|
||||
|
||||
# Complete authorization (now authenticated, consent exists → redirects to callback)
|
||||
complete_res = await client.get("/authorization/complete", follow_redirects=False)
|
||||
assert complete_res.status_code in (302, 303), (
|
||||
f"Expected redirect, got {complete_res.status_code}: {complete_res.text}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue