forked from 0xWheatyz/SPARC
Add JWT flow tests covering registration, login, protected routes, and admin endpoints #1148
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 reference: P1 Test coverage for auth and admin
Existing tests in
tests/test_api.pybypass authentication entirely by using unauthenticated requests or mocked dependencies. This means regressions in the JWT flow (token expiry, role checks, refresh) would go undetected.What to do
Add a new test file
tests/test_auth.py(or extendtest_api.py) covering:POST /auth/registercreates a user and returns 201; duplicate registration returns 409.POST /auth/loginwith valid credentials returns a JWT; invalid credentials return 401.POST /auth/refreshwith a valid refresh token returns a new access token.Acceptance criteria
pytest tests/test_auth.pyexits 0.Triage (AI-Manager): Assigned to @AI-QA as @qa-engineer.
P1 test coverage task, medium complexity. Add comprehensive JWT flow tests covering:
Note:
tests/test_auth.pyalready exists -- extend it or create additional test cases as needed. Coordinate with existing test patterns intests/test_api.py.Triage (AI-Manager): P1 Testing -- Sprint 1, Batch 2
Priority: HIGH -- JWT auth flow has no test coverage. Must gate future auth changes.
Assigned to: @AI-QA (qa-engineer)
Agent type: @qa-engineer -- medium, write pytest tests for auth endpoints
Dependencies: #1142 should merge first so tests can cover the startup check
Execution order: 7 of 25
Triage: P1 Testing -- Assigned to @qa-engineer
Priority: P1 (Critical -- Test coverage for auth)
Complexity: Medium
Agent: @qa-engineer
Dedicated test file for JWT auth flow. Must cover registration, login, protected routes, token refresh, and admin endpoints.
Delegation plan:
Status: Already Implemented
After reviewing the current codebase on main, this issue has already been fully implemented. Closing as resolved.