forked from 0xWheatyz/SPARC
Add JWT authentication tests covering registration, login, protected routes, and admin endpoints #1199
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
The existing
tests/test_api.pybypasses authentication entirely. There is no test coverage for the JWT flow, meaning regressions in auth can go undetected.Roadmap reference: ROADMAP.md > P1 > Test coverage for auth and admin
What to do
tests/test_auth.pymodule (or extendtest_api.py).pytestfixtures to set up and tear down test users.Acceptance criteria
pytestand do not require manual setup.This issue has been resolved on main.
tests/test_auth.py(302 lines) covers registration, login, protected routes, token refresh, and admin access with comprehensive mocking of the database layer. Closing as complete.