def get_order(self, event_id): session = {} event = Event(event_id=event_id, session=session, **self.api_settings) latest_date = ( datetime.date.today() + datetime.timedelta(days=7) ) performances = event.get_performances( latest_date=latest_date ) for p in reversed(performances): if p.date.weekday() != 5: performance = p break ticket_type = performance.get_availability()[0] despatch_method = performance.despatch_methods[0] concession = ticket_type.get_concessions( no_of_tickets=1, despatch_method=despatch_method )[0][0] concession_list = [concession] core = Core(session=session, **self.api_settings) return core.create_order( concessions=concession_list, despatch_method=despatch_method, )
def setUp(self): super(ConcessionTests, self).setUp() session = {} event = Event(event_id='6IF', session=session, **self.api_settings) latest_date = ( datetime.date.today() + datetime.timedelta(days=7) ) performances = event.get_performances( latest_date=latest_date ) for p in reversed(performances): if p.date.weekday() != 5: performance = p break ticket_types = performance.get_availability() ticket_type = ticket_types[0] ticket_concessions = ticket_type.get_concessions( no_of_tickets=1, despatch_method=performance.despatch_methods[0] ) concessions = ticket_concessions[0] self.concession = concessions[0]
def setUp(self): super(TicketTypeTests, self).setUp() session = {} event = Event(event_id='6IF', session=session, **self.api_settings) latest_date = ( datetime.date.today() + datetime.timedelta(days=7) ) performances = event.get_performances( latest_date=latest_date ) for p in reversed(performances): if p.date.weekday() != 5: performance = p break ticket_types = performance.get_availability( include_user_commission=True ) self.ticket_type = ticket_types[0]
def setUp(self): super(MakeReservationTests, self).setUp() session = {} event = Event(event_id='6IF', session=session, **self.api_settings) latest_date = ( datetime.date.today() + datetime.timedelta(days=7) ) performances = event.get_performances( latest_date=latest_date ) for p in reversed(performances): if p.date.weekday() != 5: performance = p break ticket_types = performance.get_availability() ticket_type = ticket_types[0] despatch_method = performance.despatch_methods[0] ticket_concessions = ticket_type.get_concessions( no_of_tickets=1, despatch_method=despatch_method ) concessions = ticket_concessions[0] concession = concessions[0] concession_list = [concession] core = Core(session=session, **self.api_settings) order = core.create_order( concessions=concession_list, despatch_method=despatch_method, ) self.trolley = Trolley(session=session, **self.api_settings) self.trolley.add_order(order) self.reservation = self.trolley.get_reservation()
def setUp(self): session = {} event = Event(event_id='6IF', session=session, **self.api_settings) latest_date = ( datetime.date.today() + datetime.timedelta(days=7) ) self.performances = event.get_performances( latest_date=latest_date ) self.performance = self.performances[0]
def setUp(self): session = {} event = Event(event_id='6IF', session=session, **self.api_settings) latest_date = ( datetime.date.today() + datetime.timedelta(days=7) ) self.performances = event.get_performances( latest_date=latest_date ) for p in reversed(self.performances): if p.date.weekday() != 5: self.performance = p break
def setUp(self): super(DespatchMethodTests, self).setUp() session = {} event = Event(event_id='6IF', session=session, **self.api_settings) latest_date = ( datetime.date.today() + datetime.timedelta(days=7) ) self.performances = event.get_performances( latest_date=latest_date ) for p in reversed(self.performances): if p.date.weekday() != 5: self.performance = p break self.despatch_methods = self.performance.get_despatch_methods() self.despatch_method = self.despatch_methods[0]
class ValidEventTests(InterfaceObjectTestCase): def setUp(self): super(ValidEventTests, self).setUp() session = {} self.event = Event( event_id='6IF', session=session, **self.api_settings) def test_string_properties(self): for prop_name in ( 'description', 'information', 'venue_desc', 'venue_info', 'venue_addr', 'supplier_desc', 'city_code', 'city_desc', 'country_code', 'country_desc', 'latitude', 'longitude', 'event_id', 'event_type' ): self.assertIsInstance(getattr(self.event, prop_name), str) def test_categories(self): found = False for c in self.event.categories: if c.code == 'theatre': found = True self.assertTrue( found, msg="'Theatre' category not found in event category list" ) def test_float_properties(self): for prop_name in ( 'min_seatprice_float', ): self.assertIsInstance(getattr(self.event, prop_name), float) def test_unicode_properties(self): for prop_name in ( 'min_seatprice', 'min_combined_price', ): self.assertIsInstance(getattr(self.event, prop_name), six.text_type) def test_boolean_properties(self): for prop_name in ( 'has_no_perfs', 'is_meta_event' ): self.assertIsInstance(getattr(self.event, prop_name), bool) def test_images(self): for img in ( # 'get_large_image', 'get_medium_image', 'get_small_image', # 'get_seating_plan', ): self.assertIsNotNone(getattr(self.event, img)) def test_performances_is_list(self): self.assertIsInstance(self.event.get_performances(), list) def test_all_performances(self): self.assertTrue(self.event.get_performances()) def test_performances_contains_performance(self): performances = self.event.get_performances() for perf in performances: self.assertIsInstance(perf, Performance) def test_no_performances_old_date(self): latest_date = ( datetime.date.today() + datetime.timedelta(days=-1) ) self.assertFalse( self.event.get_performances( latest_date=latest_date ) ) def test_performances_one_week(self): latest_date = ( datetime.date.today() + datetime.timedelta(days=6) ) self.assertTrue( self.event.get_performances( latest_date=latest_date ) ) def test_performance_calendar(self): self.event.get_performances() self.assertTrue(self.event.performance_calendar) def test_performance_calendar_empty(self): latest_date = ( datetime.date.today() + datetime.timedelta(days=-1) ) self.event.get_performances(latest_date=latest_date) self.assertFalse(self.event.performance_calendar)
def setUp(self): session = {} event = Event(event_id='6IF', session=session, **self.api_settings) latest_date = ( datetime.date.today() + datetime.timedelta(days=7) ) performances = event.get_performances( latest_date=latest_date ) for p in reversed(performances): if p.date.weekday() != 5: performance = p break ticket_types = performance.get_availability() ticket_type = ticket_types[0] despatch_method = performance.despatch_methods[0] ticket_concessions = ticket_type.get_concessions( no_of_tickets=1, despatch_method=despatch_method ) concessions = ticket_concessions[0] concession = concessions[0] concession_list = [concession] core = Core(session=session, **self.api_settings) order = core.create_order( concessions=concession_list, despatch_method=despatch_method, ) self.trolley = Trolley(session=session, **self.api_settings) self.trolley.add_order(order) self.reservation = self.trolley.get_reservation() customer_address = Address( address_line_one='1 Test Lane', address_line_two=None, town='Test Town', county='County', postcode='AB12 3CD', country_code='GB' ) customer = Customer( title='Mr', first_name='Test', last_name='User', email_address='*****@*****.**', home_phone='01234567890', work_phone='01234567890', address=customer_address, user_can_use_data=True, supplier_can_use_data=False, world_can_use_data=False ) self.purchase_response = self.reservation.purchase_reservation( customer=customer, )