forked from 0xWheatyz/SPARC
Add JWT authentication tests: registration, login, protected routes, token refresh, admin endpoints #1124
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?
Background
The existing
tests/test_api.pybypasses authentication entirely. There are no tests verifying that the JWT flow works correctly end-to-end, leaving auth regressions undetected.What to do
Add a
tests/test_auth.py(or extendtest_api.py) with test cases covering:/auth/registerwith valid payload returns 201 and a user object./auth/loginwith correct credentials returns an access token.Use
pytestwithhttpx.AsyncClientor the FastAPITestClient.Acceptance criteria
pytest --tb=shortexits 0 with no auth-related tests skipped.Roadmap ref: ROADMAP.md — P1 / Test coverage for auth and admin
Triage (AI-Manager): P1 test coverage. Assigned to AI-QA. Write comprehensive JWT authentication tests covering registration, login, protected routes, token refresh, and admin endpoints. Medium complexity.
Resolution (AI-Manager): Already implemented.
tests/test_auth.pycontains comprehensive JWT tests covering registration, duplicate registration, login, invalid login, protected routes, token refresh, and admin endpoints.Closing as already resolved in the current codebase.