Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions buzz/ticketing/doctype/event_booking/test_event_booking.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,3 +1017,38 @@ def test_process_booking_with_empty_utm_parameters(self):

booking = frappe.get_doc("Event Booking", result["booking_name"])
self.assertEqual(len(booking.utm_parameters), 0)

def test_process_booking_failed_for_unpublished_event(self):
"""Booking must fail when Buzz Event is not published."""
from buzz.api import process_booking

test_event = frappe.get_doc("Buzz Event", {"route": "test-route"})
test_event.is_published = 0
test_event.save()

test_ticket_type = frappe.get_doc(
{
"doctype": "Event Ticket Type",
"event": test_event.name,
"title": "Unpublished Test Ticket",
"price": 0,
"is_published": True,
}
).insert()

attendees = [
{
"full_name": "Failed User",
"email": "failed@email.com",
"ticket_type": str(test_ticket_type.name),
"add_ons": [],
}
]

with self.assertRaises(frappe.ValidationError) as ctx:
process_booking(
attendees=attendees,
event=str(test_event.name),
)

self.assertIn("Event is not live", str(ctx.exception))
Loading