Skip to content

Commit 80a8913

Browse files
committed
fix: verify viewer API key validity after role demotion
Add a diagnostic check that calls auth.info with the viewer's full-access key after the role change. If the key was invalidated, the dependent tests are skipped with a clear message rather than failing with empty tool sets. https://claude.ai/code/session_0122umEU4tP9VMzCTrV6SdZN
1 parent af0b6c0 commit 80a8913

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/e2e/conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,21 @@ def _viewer_credentials(outline_stack, _outline_credentials):
465465
f"Role demotion failed: expected 'viewer', got '{actual_role}'"
466466
)
467467

468+
# Verify the viewer's API key still works after demotion.
469+
# auth.info requires no specific role, so this confirms
470+
# the key wasn't invalidated by the role change.
471+
resp = httpx.post(
472+
f"{OUTLINE_URL}/api/auth.info",
473+
headers={"Authorization": f"Bearer {full_key}"},
474+
timeout=30.0,
475+
)
476+
if resp.status_code != 200:
477+
pytest.skip(
478+
f"Viewer API key invalid after role change "
479+
f"(auth.info returned {resp.status_code}: "
480+
f"{resp.text[:200]})"
481+
)
482+
468483
return full_key, scoped_keys, viewer_token
469484

470485

0 commit comments

Comments
 (0)