test: guard the crudauth follow-up behaviors - #300
emiliano-go wants to merge 2 commits into
Conversation
Add regression coverage for the composition-root wiring and the fixes from the migration: rate limiter and session backends chosen independently; the tier limit read through the request's own database dependency; each shared Redis client built from its own settings and reused by crudauth and the cache; one password policy shared by the signup schema and crudauth; admin passwords hashed and policy-checked off the event loop; logins finished through the session transport's complete_login; and the mounted auth URLs unchanged. Every test was checked against a mutated implementation to confirm it fails when the behavior regresses. Full suite: 324 passing; ruff and mypy clean.
|
One thing I deliberately left out, to keep the suite dependency-free: an automated check of the limiter against a real Redis. The single-process run against Postgres and Redis already confirmed that per-path counters land in Redis under the expected keys, but no test exercises the If you want CI to require a Redis service, I can add a small test marked |
|
300th PR btw 🥳! |
Cover the composition root, OAuth and session wiring, password policy, the auth URL contract, gated docs, CORS defaults, constraint naming, api_keys index hygiene, and generic route errors: - OAuth provider selection, new-user name bounds, session transport settings, IPv6 rate-limit keys, and the rate-limit fallbacks; - password policy drift, admin hashing and policy checks, login through the session transport, and the auth URL contract; - gated docs served from the configured URLs, and crudauth initialization on startup; - explicit CORS defaults, the standard metadata naming convention, and no duplicated single-column indexes; - generic API key 404 and 403 bodies, and absolute same-origin OAuth redirects refused. Each test was checked against a mutated implementation. Full suite: 345 passing; ruff and mypy clean.
Adds regression coverage for the wiring and fixes landed in #292, plus the earlier auth, admin, CORS, docs, data-layer and error-handling changes.
What is covered:
RATE_LIMITER_BACKENDandSESSION_BACKENDare selected independently, so the limiter no longer follows the session backend.infrastructure/redis.pyis built from its own settings, and the same clients are injected into crudauth and the cache backend.PASSWORD_*settings, so the documented rules cannot drift from the enforced ones. A password missing several classes reports all of them./loginfinishes through the session transport'scomplete_login, forwardingremember_meand the login metadata./api/v1/auth/*and OAuth URLs are unchanged. Only a fully configured Google is wired, and an absolute same-originredirect_tois refused like any other absolute target./64, and crudauth is initialized on startup.DOCS_URL,REDOC_URLandOPENAPI_URL.Verification:
ruffandmypyare clean.