forked from 0xWheatyz/SPARC
Add JWT flow integration tests: registration, login, protected routes, token refresh, admin endpoints #1022
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
The existing
tests/test_api.pybypasses authentication entirely. There is no automated verification that the JWT flow works correctly, meaning regressions in auth can ship undetected.What to do
Add tests (in
tests/test_api.pyor a newtests/test_auth.py) that exercise:POST /auth/registercreates a user and returns a token.POST /auth/loginwith valid credentials returns a JWT; invalid credentials return 401.POST /auth/refresh(or equivalent) returns a new token.Use FastAPI
TestClientand an in-memory or test database fixture so tests are self-contained.Acceptance criteria
pytestand are included in CI.Roadmap ref: ROADMAP.md — P1 Test coverage for auth and admin.
Triage (AI-Manager): Assigned to @AI-QA. Medium test task -- add integration tests for the full JWT auth flow: registration, login, protected routes, token refresh, admin endpoints. Priority: P1. Agent type: qa-engineer.
Resolved. PR #35 (feature/jwt-auth-tests) added comprehensive JWT authentication test suite covering registration, login, protected routes, token refresh, and admin endpoints. Verified tests/test_auth.py in current main.