Skip to content

Sprint 4 PR 4.6b — integration tests for organizations router - #231

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

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

Conversation

@tomqwu

@tomqwu tomqwu commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

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

Coverage

tests/integration/test_organizations.py — 15 tests covering:

  • POST /organizations/ — success + duplicate-id 409
  • GET /organizations/{id} — success + 404
  • GET /organizations/ — envelope shape, q= search filter, include_cancelled=true|false toggle
  • PUT /organizations/{id} — partial update + 404
  • POST /organizations/{id}/cancel and /restore — admin gate (403 without bearer), sets/clears cancelled_at / data_retention_until / deletion_scheduled_at
  • DELETE /organizations/{id} — success + 404

Validation

  • poetry run pytest tests/integration/ — 58 passed (was 43)
  • poetry run pytest tests/integration/test_organizations.py -v — 15 passed
  • poetry run pytest tests/unit -q — 342 passed, 21 skipped
  • poetry run black tests/integration/test_organizations.py — clean
  • poetry run ruff check tests/integration/test_organizations.py — clean

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

Notes

  • The list-with-cancelled tests scope the query with q= (baked into the fixture's org name) so the assertion isn't sensitive to unrelated orgs created by concurrent tests spilling past page 1 of the default pagination.
  • The missing-bearer test asserts 403 (FastAPI HTTPBearer returns 403, not 401, when the Authorization header is missing).

Follow-ups

Next integration files to revive: events, teams, availability.


Generated by Claude Code

Summary: extend the resurrected tests/integration/ tier (Sprint 4 PR
4.6b) with a fourth production-endpoint file that drives the
/organizations router over real HTTP against the session-scoped uvicorn
api_server fixture. Covers create + duplicate rejection, get,
list-envelope + q-search + include_cancelled=true/false, PUT partial
update + 404, admin-gated cancel/restore including the
missing-bearer-token 403 check, and hard delete + 404.

Changed files:
  tests/integration/test_organizations.py (new, 15 tests)

Validation:
  poetry run pytest tests/integration/ -q               # 58 passed
  poetry run pytest tests/integration/test_organizations.py -v  # 15 passed
  poetry run pytest tests/unit -q                        # 342 passed, 21 skipped
  poetry run black tests/integration/test_organizations.py
  poetry run ruff check tests/integration/test_organizations.py

Follow-ups: continue file-by-file revival with events, teams, and
availability routers under tests/integration/ to broaden real-HTTP
coverage of the active surface.
@tomqwu
tomqwu marked this pull request as ready for review July 17, 2026 13:04
@tomqwu
tomqwu merged commit 000fb15 into main Jul 17, 2026
5 checks passed
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