Adds pytest coverage for metrics, click_log, role_permissions, and videos (straightforward, standard get_db-only endpoints).
Adds pytest coverage for pending-identifications, pending-linkages, and reported-photos — these read/write the separate auth database (DATABASE_URL_AUTH) via raw SQL against tables owned by viewer-frontend/prisma/schema-auth.prisma. Extended tests/conftest.py with a second test-DB engine/session (test_auth_db_session) that mirrors that schema via raw DDL, and wired get_auth_db into the test_client dependency overrides.
Ran the full suite locally (venv + local Postgres via Docker): 183 passed, 0 new failures. The 8 pre-existing failures in test_api_faces.py/test_api_jobs.py/test_api_photos.py are unrelated drift, not caused by this change.
Known gap / follow-up
pending_photos.py (file upload approve/reject with hash-based duplicate detection + filesystem moves) is intentionally left uncovered — it needs a dedicated filesystem-mocking strategy that felt out of scope for this pass.
There is currently no CI job that runs pytest tests/ at all (only docker-ci, secret-scan, skip-ci-check, e2e exist in .gitea/workflows/ci.yml), so this suite is only exercised via npm run test:backend locally today. Wiring a test-backend CI job is a good next follow-up.
Test plan
npm run test:backend (against a local Postgres) — 183 passed
No changes to e2e/, viewer-frontend/, or CI config in this PR
## Summary
- Adds pytest coverage for `metrics`, `click_log`, `role_permissions`, and `videos` (straightforward, standard `get_db`-only endpoints).
- Adds pytest coverage for `pending-identifications`, `pending-linkages`, and `reported-photos` — these read/write the separate auth database (`DATABASE_URL_AUTH`) via raw SQL against tables owned by `viewer-frontend/prisma/schema-auth.prisma`. Extended `tests/conftest.py` with a second test-DB engine/session (`test_auth_db_session`) that mirrors that schema via raw DDL, and wired `get_auth_db` into the `test_client` dependency overrides.
- Ran the full suite locally (venv + local Postgres via Docker): 183 passed, 0 new failures. The 8 pre-existing failures in `test_api_faces.py`/`test_api_jobs.py`/`test_api_photos.py` are unrelated drift, not caused by this change.
## Known gap / follow-up
- `pending_photos.py` (file upload approve/reject with hash-based duplicate detection + filesystem moves) is intentionally left uncovered — it needs a dedicated filesystem-mocking strategy that felt out of scope for this pass.
- There is currently no CI job that runs `pytest tests/` at all (only `docker-ci`, `secret-scan`, `skip-ci-check`, `e2e` exist in `.gitea/workflows/ci.yml`), so this suite is only exercised via `npm run test:backend` locally today. Wiring a `test-backend` CI job is a good next follow-up.
## Test plan
- [x] `npm run test:backend` (against a local Postgres) — 183 passed
- [x] No changes to `e2e/`, `viewer-frontend/`, or CI config in this PR
Adds pytest coverage for metrics, click_log, role_permissions, videos,
pending-identifications, pending-linkages, and reported-photos — the
last three required extending conftest with a second (auth) test
database + DDL mirroring the Prisma schema-auth.prisma tables, since
those endpoints read/write DATABASE_URL_AUTH via raw SQL.
pending-photos.py is intentionally left uncovered for now (heavy
filesystem/hash-based duplicate-detection logic needs its own mocking
strategy) and tracked as a follow-up.
ilia
merged commit fc8b47863d into dev2026-07-14 17:17:20 -05:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
metrics,click_log,role_permissions, andvideos(straightforward, standardget_db-only endpoints).pending-identifications,pending-linkages, andreported-photos— these read/write the separate auth database (DATABASE_URL_AUTH) via raw SQL against tables owned byviewer-frontend/prisma/schema-auth.prisma. Extendedtests/conftest.pywith a second test-DB engine/session (test_auth_db_session) that mirrors that schema via raw DDL, and wiredget_auth_dbinto thetest_clientdependency overrides.test_api_faces.py/test_api_jobs.py/test_api_photos.pyare unrelated drift, not caused by this change.Known gap / follow-up
pending_photos.py(file upload approve/reject with hash-based duplicate detection + filesystem moves) is intentionally left uncovered — it needs a dedicated filesystem-mocking strategy that felt out of scope for this pass.pytest tests/at all (onlydocker-ci,secret-scan,skip-ci-check,e2eexist in.gitea/workflows/ci.yml), so this suite is only exercised vianpm run test:backendlocally today. Wiring atest-backendCI job is a good next follow-up.Test plan
npm run test:backend(against a local Postgres) — 183 passede2e/,viewer-frontend/, or CI config in this PR