forked from 0xWheatyz/SPARC
Add JWT flow tests: registration, login, protected routes, token refresh, and admin endpoints #1598
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
The existing API tests in
tests/test_api.pybypass authentication entirely. The JWT auth flow has no test coverage.What to do
auth.pyAcceptance criteria
Ref: ROADMAP.md P1 - Test coverage for auth and admin
This issue is already resolved in main.
tests/test_auth.py(303 lines) has 17 comprehensive tests covering: registration (first user admin, subsequent user, duplicate email), login (valid/invalid credentials), protected routes (valid/missing/expired/wrong token type), token refresh (valid/invalid/wrong token type), and admin endpoints (list users, change role, self-role change prevention).