Split load_config into per-section readers, use contextlib.suppress and a single condition where ruff asked, remove stale noqa comments, add the SIM and RUF100 rules, share the sign_in test helper, align AD-6 with the code and record the remaining deferred findings. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N3t4WL7bd9bdHHNjEsxzqC
17 lines
612 B
Python
17 lines
612 B
Python
"""Shared test helpers."""
|
|
|
|
from django.test import Client
|
|
|
|
from portal.accounts.session_store import LOGIN_FLOW
|
|
from portal.adapters.idp import Flow
|
|
|
|
|
|
def sign_in(adapters, username="alice", next_path=None, client=None):
|
|
"""Run the whole flow with the fake provider; returns (client, callback response)."""
|
|
client = client or Client()
|
|
adapters.idp.sign_in_as(username)
|
|
query = f"?next={next_path}" if next_path else ""
|
|
client.get("/auth/login" + query)
|
|
flow = Flow.from_dict(client.session[LOGIN_FLOW])
|
|
return client, client.get("/auth/callback", adapters.idp.callback_params(flow))
|