forked from 0xWheatyz/SPARC
Add JWT flow tests: registration, login, protected routes, token refresh, admin endpoints #1450
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Roadmap item: P1 Test coverage for auth and admin
Problem
The existing
tests/test_api.pybypasses authentication entirely. There is no coverage of the JWT lifecycle, so regressions in auth logic would go undetected.What to do
Create
tests/test_auth.py(or extend the existing file) with tests covering:Acceptance criteria
pytest.auth.pyreaches at least 80%.[Triage] P1 test coverage issue (medium complexity). Assigned to @AI-QA. Dispatching to @qa-engineer agent for implementation.
[Verification] All acceptance criteria met. Verified complete.
tests/test_auth.pycovers: registration (first user admin, subsequent user, duplicate email), login (valid returns tokens, invalid returns 401), protected routes (valid token, missing token, expired token, wrong token type), token refresh (valid, invalid, wrong type), and admin endpoints (list users, change role, non-admin rejected). Closing as implemented.