forked from 0xWheatyz/SPARC
Add JWT authentication tests: registration, login, protected routes, token refresh, admin endpoints #1100
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
Existing tests in
tests/test_api.pybypass authentication entirely. There is no test coverage for the JWT flow, meaning auth regressions could ship undetected.What to do
Create
tests/test_auth.py(or extend the existing file) covering:/auth/registerwith valid payload returns 201 and a user object./auth/loginwith correct credentials returns a JWT access token.expin the past is rejected with 401.Use
pytestfixtures andhttpx.AsyncClient(already used in the project).Acceptance criteria
pytest tests/test_auth.pyexits 0 in the local Docker environment.Roadmap reference: P1 - Test coverage for auth and admin
This issue has been verified as already implemented in the current codebase. The acceptance criteria are met based on code review. Closing as completed.