Skip to content

test(bookings): build booking fixtures with factories and split by behaviour - #543

Merged
harshtandiya merged 6 commits into
refactor/test-to-factories-1from
refactor/test-to-factories-2
Oct 6, 2026
Merged

harshtandiya merged 6 commits into
refactor/test-to-factories-1from
refactor/test-to-factories-2

Conversation

@harshtandiya

Copy link
Copy Markdown
Collaborator

What changed

This is lane 1 of the test refactor. It is stacked on #540.

  • New factories: EventPaymentFactory, with a received trait that gives each payment its own payment id, and IntegrationRequestFactory.
  • Split of test_event_booking.py:
    • The file was 1,587 lines. It is now split into test_booking_totals, test_offline_booking, test_booking_emails and test_booking_confirmation.
    • test_event_booking.py itself keeps availability, UTM and the Zoom last-name tests.
  • Split of the refund tests:
    • Refund request, summary and ceiling stay in test_event_booking_refund.py.
    • Webhook and sync tests move to test_refund_sync.py.
    • Both files share refund_test_case.py.
  • test_guest_booking and test_event_eligibility now use factories.
  • Every file is under 300 lines. No test reads test-route or uses a date literal any more.

Tests: 118 → 111.

  • I deleted the 6 tests on the plan's Delete list (the UTM-persistence tests and tax_exclusive_still_works).
  • I also deleted tax_inclusive_with_single_ticket, because it is a duplicate of tax_inclusive_calculation.
  • The guest OTP tests do not overlap with the tests in api/booking, so I kept all of them.

Kept for other importers: make_payment_gateway stays in test_event_booking_refund.py. Its body now uses PaymentGatewayFactory. The cleanup PR deletes it.

Candidates for the cleanup PR:

  • A trait for a custom-price ticket type.
  • An offline_awaiting_verification booking trait.
  • Factories for Event Check In and Attendee Ticket Add-on. This lane uses the production helpers for now.
  • Move BookingRefundTestCase into buzz/tests/base_test_cases.py.

Demo

Not applicable. This PR changes only tests (skip-demo).

Testing

  • ruff 0.8.1 format and check pass, and every changed file compiles.
  • I could not run the test suite locally. CI runs the full suite.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SWM6kF7ncqfQx9eYpBKcbm


Generated by Claude Code

claude added 2 commits October 6, 2026 13:27
Lane-owned factories for the booking refund tests. EventPayment's
received trait gives each payment a unique gateway id, since refund
webhooks look the payment up by it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SWM6kF7ncqfQx9eYpBKcbm
test_event_booking.py splits into totals, offline, emails and
confirmation files; it keeps ticket availability, process_booking and
the Zoom last-name tests. test_event_booking_refund.py keeps refund
requests and the refund ceiling; webhook and sync tests move to
test_refund_sync.py. Both share BookingRefundTestCase in
refund_test_case.py. Every class builds its own event instead of
reading test-route.

Drops the UTM child-table persistence tests, tax_exclusive_still_works
and tax_inclusive_with_single_ticket, which repeat
total_calculation_with_taxes and tax_inclusive_calculation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SWM6kF7ncqfQx9eYpBKcbm
@harshtandiya harshtandiya added the skip-demo Skip adding a video / screenshot in PR description. Passes the failing CI for demo addition label Oct 6, 2026 — with Claude

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@harshtandiya
harshtandiya merged commit 97845b6 into refactor/test-to-factories-1 Oct 6, 2026
8 checks passed
@harshtandiya
harshtandiya deleted the refactor/test-to-factories-2 branch October 6, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-demo Skip adding a video / screenshot in PR description. Passes the failing CI for demo addition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants