forked from 0xWheatyz/SPARC
Add auth/JWT integration tests: registration, login, protected routes, token refresh, admin endpoints #360
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?
Problem
Existing tests in
tests/test_api.pybypass authentication entirely. The JWT flow — registration, login, token issuance, protected-route access, token refresh, and admin-only endpoint enforcement — has no automated test coverage.Work
tests/test_auth.py(or extendtest_api.py) with tests for:POST /auth/register: successful registration, duplicate username rejection.POST /auth/login: valid credentials return a JWT, invalid credentials return 401.httpx.AsyncClientwith the FastAPITestClientpattern.Acceptance Criteria
auth.pyreaches at least 80%.Reference
Roadmap item: P1 Test coverage for auth and admin.
[Triage] Already implemented in main. tests/test_auth.py contains comprehensive JWT integration tests covering registration, login, protected routes, token refresh, and admin endpoints. Closing as resolved.