Ejemplo n.º 1
0
    def test_get_seat_ids_where_ids_are_missing(self):
        ticket_order_one = TicketOrder('a', seats=[
            Seat('A1'), Seat('A2'), Seat(None),
        ])

        ticket_order_two = TicketOrder('b', seats=[
            Seat('B1'), Seat(None), Seat('B3'),
        ])

        order = Order(1, ticket_orders=[ticket_order_one, ticket_order_two])

        seat_ids = order.get_seat_ids()
        assert seat_ids == ['A1', 'A2', 'B1', 'B3']
Ejemplo n.º 2
0
    def test_unique_seat_text(self):
        ticket_order_one = TicketOrder('a', seats=[
            Seat('A1', seat_text='Hell bad'), Seat('A2'), Seat('A3'),
        ])

        ticket_order_two = TicketOrder('b', seats=[
            Seat('B1', seat_text='Hell good'), Seat('B2'), Seat('B3'),
        ])

        order = Order(1, ticket_orders=[ticket_order_one, ticket_order_two])

        seat_text = order.unique_seat_text()
        assert 'Hell bad' in seat_text
        assert 'Hell good' in seat_text
Ejemplo n.º 3
0
    def test_get_seats(self):
        ticket_order_one = TicketOrder('a', seats=[
            Seat('A1'), Seat('A2'), Seat('A3'),
        ])

        ticket_order_two = TicketOrder('b', seats=[
            Seat('B1'), Seat('B2'), Seat('B3'),
        ])

        order = Order(1, ticket_orders=[ticket_order_one, ticket_order_two])

        seats = order.get_seats()
        assert [seat.id for seat in seats] == [
            'A1', 'A2', 'A3', 'B1', 'B2', 'B3',
        ]
Ejemplo n.º 4
0
    def test_from_api_data_with_decimal(self):
        data = {
            'discount_code': 'ADULT',
            'discount_desc': 'Adult standard',
            'no_of_seats': 2,
            'sale_seatprice': 25,
            'sale_surcharge': Decimal('2.50'),
            'total_sale_seatprice': 50,
            'total_sale_surcharge': Decimal('5.00'),
            'seats': [
                {'full_id': 'ABC123'},
                {'full_id': 'DEF456'},
            ],
        }

        ticket_order = TicketOrder.from_api_data(data)

        assert ticket_order.code == 'ADULT'
        assert ticket_order.number_of_seats == 2
        assert ticket_order.description == 'Adult standard'
        assert isinstance(ticket_order.seatprice, (int, Decimal))
        assert ticket_order.seatprice == Decimal('25.0')
        assert isinstance(ticket_order.surcharge, (int, Decimal))
        assert ticket_order.surcharge == Decimal('2.5')
        assert isinstance(ticket_order.total_seatprice, (int, Decimal))
        assert ticket_order.total_seatprice == Decimal('50.0')
        assert isinstance(ticket_order.total_surcharge, (int, Decimal))
        assert ticket_order.total_surcharge == Decimal('5.0')
        assert len(ticket_order.seats) == 2
        assert ticket_order.seats[0].id == 'ABC123'
        assert ticket_order.seats[1].id == 'DEF456'
Ejemplo n.º 5
0
 def test_total_combined_price(self):
     data = {
         'discount_code': 'ADULT',
         'discount_desc': 'Adult standard',
         'no_of_seats': 2,
         'sale_seatprice': 25,
         'sale_surcharge': 2.50,
         'total_sale_seatprice': 50,
         'total_sale_surcharge': 5,
         'seats': [
             {'full_id': 'ABC123'},
             {'full_id': 'DEF456'},
         ]
     }
     ticket_order = TicketOrder.from_api_data(data)
     assert ticket_order.total_combined_price() == 55.0
Ejemplo n.º 6
0
 def test_repr(self):
     ticket_order = TicketOrder('abc123')
     assert repr(ticket_order) == '<TicketOrder abc123>'