def test_import_from_list(self):
        # test bookings
        self.ticket_client.import_from_list(ticket_list)
        p1 = Participant.query.filter_by(
            email='*****@*****.**',
            proposal_space=self.space).one_or_none()
        p2 = Participant.query.filter_by(
            email='*****@*****.**',
            proposal_space=self.space).one_or_none()
        p3 = Participant.query.filter_by(
            email='*****@*****.**',
            proposal_space=self.space).one_or_none()
        self.assertEquals(SyncTicket.query.count(), 3)
        self.assertEquals(Participant.query.count(), 3)
        self.assertEquals(len(p1.events), 2)
        self.assertEquals(len(p2.events), 1)
        self.assertEquals(len(p3.events), 1)

        # test cancellations
        cancel_list = [SyncTicket.get(self.space, 'o2', 't2')]
        self.ticket_client.import_from_list(ticket_list2,
                                            cancel_list=cancel_list)
        self.assertEquals(len(p1.events), 2)
        self.assertEquals(len(p2.events), 0)

        # test_transfers
        self.ticket_client.import_from_list(ticket_list3)
        self.assertEquals(len(p2.events), 1)
        self.assertEquals(p2.events[0],
                          Event.get(self.space, current_name='spacecon'))
        self.assertEquals(len(p3.events), 0)
def bulk_upsert(space, event_list):
    for event_dict in event_list:
        event = Event.upsert(space,
                             current_title=event_dict.get('title'),
                             title=event_dict.get('title'),
                             proposal_space=space)
        for ticket_type_title in event_dict.get('ticket_types'):
            ticket_type = TicketType.upsert(space,
                                            current_name=None,
                                            current_title=ticket_type_title,
                                            proposal_space=space,
                                            title=ticket_type_title)
            event.ticket_types.append(ticket_type)
Example #3
0
    def test_import_from_list(self):
        # test bookings
        self.ticket_client.import_from_list(ticket_list)
        p1 = Participant.query.filter_by(email='*****@*****.**', proposal_space=self.space).one_or_none()
        p2 = Participant.query.filter_by(email='*****@*****.**', proposal_space=self.space).one_or_none()
        p3 = Participant.query.filter_by(email='*****@*****.**', proposal_space=self.space).one_or_none()
        self.assertEquals(SyncTicket.query.count(), 3)
        self.assertEquals(Participant.query.count(), 3)
        self.assertEquals(len(p1.events), 2)
        self.assertEquals(len(p2.events), 1)
        self.assertEquals(len(p3.events), 1)

        # test cancellations
        cancel_list = [SyncTicket.get(self.space, 'o2', 't2')]
        self.ticket_client.import_from_list(ticket_list2, cancel_list=cancel_list)
        self.assertEquals(len(p1.events), 2)
        self.assertEquals(len(p2.events), 0)

        # test_transfers
        self.ticket_client.import_from_list(ticket_list3)
        self.assertEquals(len(p2.events), 1)
        self.assertEquals(p2.events[0], Event.get(self.space, current_name='spacecon'))
        self.assertEquals(len(p3.events), 0)
Example #4
0
def bulk_upsert(project, event_list):
    for event_dict in event_list:
        event = Event.upsert(project, current_title=event_dict.get('title'), title=event_dict.get('title'), project=project)
        for ticket_type_title in event_dict.get('ticket_types'):
            ticket_type = TicketType.upsert(project, current_name=None, current_title=ticket_type_title, project=project, title=ticket_type_title)
            event.ticket_types.append(ticket_type)
Example #5
0
def bulk_upsert(space, event_list):
    for event_dict in event_list:
        event = Event.upsert(space, current_title=event_dict.get('title'), title=event_dict.get('title'), proposal_space=space)
        for ticket_type_title in event_dict.get('ticket_types'):
            ticket_type = TicketType.upsert(space, current_name=None, current_title=ticket_type_title, proposal_space=space, title=ticket_type_title)
            event.ticket_types.append(ticket_type)