Skip to content

Sprint 4 PR 4.6b — integration tests for events router - #233

Merged
tomqwu merged 1 commit into
mainfrom
sprint-4-pr-4-6b-events-integration
Jul 18, 2026
Merged

tomqwu merged 1 commit into
mainfrom
sprint-4-pr-4-6b-events-integration

Conversation

@tomqwu

@tomqwu tomqwu commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

Continues Sprint 4 PR 4.6b (file-by-file revival of the tests/integration/ tier). Adds a fifth production-endpoint integration file that drives the /events router over real HTTP against the session-scoped uvicorn api_server fixture (introduced in PR 4.6a).

Coverage

tests/integration/test_events.py — 18 tests covering:

  • POST /events/ — success, admin gate (403 without bearer), duplicate id (409), foreign-org verify_org_member (403/404), invalid time range (400)
  • GET /events/{event_id} — success + 404
  • GET /events/ — envelope shape, org_id scoping, q= search on type/id, status=upcoming filter
  • PUT /events/{event_id} — partial update, 404, missing-auth 403
  • DELETE /events/{event_id} — success + 404
  • GET /events/{event_id}/available-people — role-matched people
  • GET /events/{event_id}/validation — missing_config warning shape

Validation

  • poetry run pytest tests/integration/test_events.py -v — 18 passed
  • poetry run pytest tests/integration/ — 76 passed (was 61)
  • poetry run pytest tests/unit -q — 342 passed, 21 skipped
  • poetry run black tests/integration/test_events.py — clean
  • poetry run ruff check tests/integration/test_events.py — clean

No OpenAPI snapshot refresh (no endpoints added or changed).

Notes

  • The missing-org test accepts either 403 (verify_org_member fires first because admin isn't a member of the sentinel org id) or 404 (fallback if the guard ever moves), documenting the current gate order without brittling to it.
  • Validation warnings use the shape {"type": ..., "message_key": ..., "message_params": ...} from api/utils/response_messages.validation_warning; the assertion matches w["type"].

Follow-ups

Next integration files to revive: teams, availability.


Generated by Claude Code

Summary: Adds a fifth production-endpoint integration file that drives
the /api/v1/events router over real HTTP against the session-scoped
uvicorn api_server (introduced in PR 4.6a). Continues the file-by-file
revival of the tests/integration/ tier — next up: teams, availability.

Changed files: tests/integration/test_events.py (new, 18 tests)

Validation:
  poetry run pytest tests/integration/test_events.py -v  → 18 passed
  poetry run pytest tests/integration/                    → 76 passed
  poetry run pytest tests/unit -q                         → 342 passed, 21 skipped
  poetry run black tests/integration/test_events.py       → clean
  poetry run ruff check tests/integration/test_events.py  → clean

Coverage of /events endpoints:
  - POST   /events/                    — create success, admin gate (403),
                                         duplicate id (409), foreign-org
                                         verify_org_member (403/404),
                                         invalid time range (400)
  - GET    /events/{event_id}          — success + 404
  - GET    /events/                    — envelope shape, org_id scoping,
                                         q= search on type/id,
                                         status=upcoming filter
  - PUT    /events/{event_id}          — partial update, 404, missing-auth 403
  - DELETE /events/{event_id}          — success + 404
  - GET    /events/{event_id}/available-people — role-matched people
  - GET    /events/{event_id}/validation       — missing_config warning

No OpenAPI snapshot refresh (no endpoints added or changed).

Follow-ups: teams, availability integration files next.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSAxAttZHQ5oLxLdcZZLt6
@tomqwu
tomqwu marked this pull request as ready for review July 18, 2026 13:03
@tomqwu
tomqwu merged commit 6690902 into main Jul 18, 2026
5 checks passed
tomqwu added a commit that referenced this pull request Jul 18, 2026
Summary: Continues Sprint 4 PR 4.6b (file-by-file revival of the
tests/integration/ tier). Adds a sixth production-endpoint integration
file that drives the /availability router over real HTTP against the
session-scoped uvicorn api_server fixture. Exercises time-off, single-
date exceptions, and the recurring rrule per person.

Changed files: tests/integration/test_availability.py (new, 16 tests)

Validation:
  poetry run pytest tests/integration/test_availability.py -v → 16 passed
  poetry run pytest tests/integration/                        → 91 passed
    (with concurrent PR #232's test_teams.py also present locally)
  poetry run pytest tests/unit -q                              → 342 passed, 21 skipped
  poetry run black tests/integration/test_availability.py     → clean
  poetry run ruff check tests/integration/test_availability.py → clean

Coverage of /availability endpoints:
  - POST   /availability/                          — first-time create + missing-person 404
  - GET    /availability/{person_id}/timeoff       — empty state + list-after-add
  - POST   /availability/{person_id}/timeoff       — success, invalid range 400, overlap 409
  - PATCH  /availability/{person_id}/timeoff/{id}  — mutate dates + reason
  - DELETE /availability/{person_id}/timeoff/{id}  — removal
  - GET    /availability/{person_id}/exceptions    — empty state
  - POST   /availability/{person_id}/exceptions    — create + idempotency on duplicate
  - DELETE /availability/{person_id}/exceptions/{id} — removal
  - GET/PUT/DELETE /availability/{person_id}/rrule — get-when-null, set, idempotent clear

No OpenAPI snapshot refresh (no endpoints added or changed).

Follow-ups: continue file-by-file revival with the remaining routers
(events already up in PR #233, teams already up in PR #232).


Claude-Session: https://claude.ai/code/session_01CSAxAttZHQ5oLxLdcZZLt6

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants