Exemple #1
0
    def test_revoke_ticket_with_seat(self):
        area = seating_area_service.create_area(self.party.id, 'main', 'Main')
        seat = seat_service.create_seat(area, 0, 0, self.category_id)

        ticket = ticket_creation_service \
            .create_ticket(self.category_id, self.owner_id)

        ticket_seat_management_service \
            .occupy_seat(ticket.id, seat.id, self.owner_id)

        assert ticket.occupied_seat_id == seat.id

        events_before = event_service.get_events_for_ticket(ticket.id)
        event_types_before = {event.event_type for event in events_before}
        assert 'seat-released' not in event_types_before

        # -------------------------------- #

        ticket_revocation_service.revoke_ticket(ticket.id, self.admin_id)

        # -------------------------------- #

        assert ticket.occupied_seat_id is None

        events_after = event_service.get_events_for_ticket(ticket.id)
        event_types_after = {event.event_type for event in events_after}
        assert 'seat-released' in event_types_after
Exemple #2
0
    def test_revoke_tickets_with_seats(self):
        area = seating_area_service.create_area(self.party.id, 'main', 'Main')

        tickets = ticket_creation_service.create_tickets(
            self.category_id, self.owner_id, 2)

        ticket_ids = {ticket.id for ticket in tickets}

        for ticket in tickets:
            seat = seat_service.create_seat(area, 0, 0, self.category_id)

            ticket_seat_management_service.occupy_seat(ticket.id, seat.id,
                                                       self.owner_id)

            assert ticket.occupied_seat_id == seat.id

        # -------------------------------- #

        ticket_revocation_service.revoke_tickets(ticket_ids, self.admin_id)

        # -------------------------------- #

        for ticket in tickets:
            assert ticket.occupied_seat_id is None

            events_after = event_service.get_events_for_ticket(ticket.id)
            event_types_after = {event.event_type for event in events_after}
            assert 'seat-released' in event_types_after
Exemple #3
0
def execute(party, slug, title):
    area_service.create_area(party.id, slug, title)
    click.secho('Done.', fg='green')
 def create_area(self, slug, title):
     return area_service.create_area(self.party.id, slug, title)