Repository navigation
Sprint 4 PR 4.6b — integration tests for audit-logs router - #241
Merged
Merged
Conversation
Summary: Continues PR 4.6b file-by-file revival of the integration tier.
Adds real-HTTP coverage for the admin-only /api/v1/audit-logs read
endpoint, including the self-recording behavior where every list call
generates its own data.exported row.
Changed files:
- tests/integration/test_audit.py (new) — 9 tests spanning:
- auth gate: admin OK, volunteer 403, unauth 401/403
- self-recording: a plain read produces a data.exported row (asserted
by re-reading with action=data.exported filter)
- org scoping: every returned row has organization_id == caller.org_id
- filters: action=, user_id=, pagination echo, unknown action returns 0
Validation:
- poetry run pytest tests/integration/test_audit.py -v — 9 passed
- poetry run black tests/integration/test_audit.py — clean
- poetry run ruff check tests/integration/test_audit.py — clean
- No OpenAPI snapshot refresh (no endpoints added or changed).
Follow-ups:
- Remaining integration files to revive: assignments, analytics,
calendar, password_reset, solutions, solver, people, webhooks.
tomqwu
marked this pull request as ready for review
July 19, 2026 13:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Continues Sprint 4 PR 4.6b (file-by-file revival of the
tests/integration/tier). Adds a production-endpoint integration file that drives the admin-only/audit-logsread endpoint over real HTTP against the session-scoped uvicornapi_serverfixture. Locks in the auth gate, the ListResponse envelope, the router's self-recording of adata.exportedrow on every list call, and the org-scoping guarantee.Coverage
tests/integration/test_audit.py— 9 tests covering:action=data.exportedfilter surfaces the new row (locks in the router'slog_audit_eventcall)organization_id == caller.org_idaction=,user_id=narrow the result set;limit/offsetechoed in envelope; unknown action →total: 0Validation
poetry run pytest tests/integration/test_audit.py -v— 9 passedpoetry run black tests/integration/test_audit.py— cleanpoetry run ruff check tests/integration/test_audit.py— cleanNo OpenAPI snapshot refresh (no endpoints added or changed).
Notes
totalacross two reads. It tolerates the edge case where the first read is the very first entry in the audit table for this org.get_current_admin_userdependency are covered end-to-end.Follow-ups
Remaining routers still to revive under
tests/integration/: assignments, analytics, calendar, password_reset, solutions, solver, people, webhooks.Generated by Claude Code