You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(testing): add pytest plugin and test issuer #630
Apps copy the same test setup: a network guard, a MongoDB switch and a mock identity provider. They test authentication with verify_audience: false, hand-made tokens or mocked validation, so their tests don't exercise audience, typ, groups or service clients as production does. There is also no documented local identity provider for development.
Proposal
Pytest plugin with a network guard and a MongoDB fixture, which apps enable by name.
foca.testing.issuer: a pytest fixture and context manager that serves OIDC discovery and JWKS on a local port (stdlib http.server; cryptography and PyJWT are already dependencies).
issuer.token(sub=..., aud=..., typ="at+jwt", groups=[...], client_id=...) returns a signed access token.
Optional user-info responses.
It doesn't depend on a test client, so it works with Flask's now and with foca.testing.Client from 0.22.0, unchanged at 1.0.0-rc1.
Docs: a testing page, plus a Compose snippet with a standard mock OIDC server pinned by digest for local development. FOCA ships no identity provider image.
FOCA's own auth tests that mock token validation move to the issuer where that makes them simpler.
Acceptance criteria
foca.testing.issuer is public, typed, documented and tested (discovery, JWKS, audience, typ, groups, user info).
An example test validates a token end to end, without verify_audience: false.
Activity