forked from 0xWheatyz/SPARC
Add JWT auth flow tests: registration, login, protected routes, token refresh, admin endpoints #1426
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?
Summary
Existing tests in
tests/test_api.pybypass authentication entirely. There is no coverage of the JWT lifecycle or admin-only access.What to do
Write tests that exercise:
Acceptance criteria
auth.pyreaches at least 80%.References
Roadmap: P1 Test coverage for auth and admin.
Already implemented.
tests/test_auth.pycovers the complete JWT lifecycle: registration (success and duplicate email), login (success and wrong password), protected routes with valid/invalid/expired tokens, token refresh flow, and admin-only endpoint access with non-admin tokens. Tests use mocked DB and real JWT token creation.Closing as completed.