forked from 0xWheatyz/SPARC
Add JWT auth integration tests (registration, login, protected routes, admin endpoints) #666
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
Existing API tests in
tests/test_api.pybypass authentication entirely. There is no test coverage for the JWT token lifecycle, meaning regressions in auth can go undetected.What to do
Add a new test module (e.g.,
tests/test_auth.py) that covers:/auth/registercreates a user and returns 201./auth/loginwith valid credentials returns an access token.Use a test database fixture so tests are isolated.
Acceptance criteria
pytestexits 0 in CI.auth.pyis above 80 %.References
Roadmap item: P1 Test coverage for auth and admin.
Triage (Repo Manager): P1 test coverage, medium complexity. Assigned to @AI-QA (qa-engineer). Requires 6 test scenarios covering the full JWT lifecycle. Should use isolated test DB fixtures. No blockers -- can be worked in parallel with the security issues.
Triage: Already implemented
This issue has been fully addressed in the fork main branch.
Verification:
tests/test_auth.py(302 lines) covers all six required scenarios: registration, login, login failure, protected route access, token refresh, and admin-only endpoints.All acceptance criteria are met. Closing.