Skip to content

test(ticketing): build coupon, ticket and report fixtures with factories - #542

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

harshtandiya merged 8 commits into
refactor/test-to-factories-1from
refactor/test-to-factories-3

Conversation

@harshtandiya

Copy link
Copy Markdown
Collaborator

What changed

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

Coupons

  • Coupon tests now build fixtures with factories.
  • The tests are split by behaviour into 4 files:
    • test_coupon_discounts
    • test_coupon_free_tickets
    • test_coupon_scope
    • test_buzz_coupon_code, which keeps the validity tests
  • The shared setup is in buzz_coupon_code/coupon_test_case.py.
  • BuzzCouponCodeFactory gets the traits percentage, flat and free_tickets. Only this lane uses those traits.

Tickets

  • test_event_ticket and test_event_ticket_type now use factories, EmailTemplateFactory and self.set_user.

Report

  • test_detailed_event_registrations now uses factories.

Tests: 89 → 72. These tests were deleted, as the plan lists:

  • buzz_coupon_code_auto_generated
  • make_qr_image_returns_png_bytes
  • the 5 report *_empty_list tests
  • the 9 report private-helper tests

Their behaviour is now asserted through the column tests. The 2 execute_returns_empty_* tests are merged into 1.

Candidates for the cleanup PR:

  • Move CouponTestCase into buzz/tests/base_test_cases.py.
  • Add an AttendeeTicketAddOnFactory. For now, this lane uses create_add_on_doc.
  • Add traits for 2 overrides:
    • TicketAddOnFactory(user_selects_option=1, options=...)
    • EventTicketTypeFactory(prices=[...]) with a custom price

Demo

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

Testing

  • ruff 0.8.1 format and check pass.
  • No get_doc({, new_doc(, date literals, test-route or imports from other test modules remain.
  • 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 4 commits October 6, 2026 13:24
Split into discount, free-ticket, scope and validity modules that share
CouponTestCase. Drop buzz_coupon_code_auto_generated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SWM6kF7ncqfQx9eYpBKcbm
Zoom sessions come from the event's own create_*_on_zoom methods. Drop
make_qr_image_returns_png_bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SWM6kF7ncqfQx9eYpBKcbm
Drop the private-helper and empty-list tests; the column tests now
cover disabled custom fields, disabled add-ons and distinct UTM names.
Merge the two execute_returns_empty tests.

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 b3337a0 into refactor/test-to-factories-1 Oct 6, 2026
8 checks passed
@harshtandiya
harshtandiya deleted the refactor/test-to-factories-3 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