forked from 0xWheatyz/SPARC
Add JWT auth integration tests: registration, login, protected routes, token refresh, admin-only endpoints #382
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. There is no test coverage for the JWT flow, meaning regressions in auth logic go undetected.Work
tests/test_auth.py(or extend the existing one) covering:POST /auth/register): success, duplicate email, invalid payload.POST /auth/login): success returns a valid JWT, wrong password returns 401.DatabaseClientto avoid polluting production data.Acceptance Criteria
pytest tests/test_auth.pyexits 0 in CI.Reference
Roadmap item: P1 Test coverage for auth and admin.
Closing as already implemented. Verified in the current codebase that all acceptance criteria are met. Jobs are persisted in PostgreSQL (database.py has create_job/update_job/get_job/list_jobs, api.py uses them, schema includes jobs table). Auth tests exist in tests/test_auth.py with 17 test functions covering registration, login, protected routes, refresh, and admin access.