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
|
|
@ -87,13 +87,22 @@ async def test_full_authorization_code_flow(client: AsyncClient) -> None:
|
|||
f"Expected HX-Redirect to /authorization/complete, got '{hx_redirect}'"
|
||||
)
|
||||
|
||||
# -- Step 3: Complete authorization → redirect to callback with code + state --
|
||||
# -- Step 3: Complete authorization → redirect to consent --
|
||||
complete_res = await client.get("/authorization/complete", follow_redirects=False)
|
||||
assert complete_res.status_code in (302, 303), (
|
||||
f"Expected redirect to callback, got {complete_res.status_code}: {complete_res.text}"
|
||||
f"Expected redirect to /consent, got {complete_res.status_code}: {complete_res.text}"
|
||||
)
|
||||
assert "/consent" in complete_res.headers["location"]
|
||||
|
||||
location = complete_res.headers["location"]
|
||||
# -- Step 3b: Approve consent → redirect to callback with code + state --
|
||||
consent_res = await client.post(
|
||||
"/consent",
|
||||
data={"action": "allow", "scope": ["openid", "profile", "email"]},
|
||||
follow_redirects=False,
|
||||
)
|
||||
assert consent_res.status_code in (302, 303)
|
||||
|
||||
location = consent_res.headers["location"]
|
||||
parsed = urlparse(location)
|
||||
assert parsed.netloc == "localhost:9000"
|
||||
assert parsed.path == "/callback"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue