def __init__(self, profile=None, conference=None):
     self.conference = conference or ConferenceFactory()
     self.profile = profile or ProfileFactory()
     self.transaction = TransactionFactory(
         ticket_item__ticketing_event__conference=self.conference,
         purchaser__matched_to_user=self.profile.user_object,
     )
示例#2
0
def make_act_app_purchase(conference, user_object):
    purchaser = PurchaserFactory(matched_to_user=user_object)
    transaction = TransactionFactory(purchaser=purchaser)
    transaction.ticket_item.ticketing_event.conference = conference
    transaction.ticket_item.ticketing_event.act_submission_event = True
    transaction.ticket_item.ticketing_event.save()
    return transaction
示例#3
0
def make_vendor_app_purchase(conference, user_object):
    bpt_event = BrownPaperEventsFactory(conference=conference,
                                        vendor_submission_event=True)
    purchaser = PurchaserFactory(matched_to_user=user_object)
    ticket_id = "%s-1111" % (bpt_event.bpt_event_id)
    ticket = TicketItemFactory(ticket_id=ticket_id)
    transaction = TransactionFactory(ticket_item=ticket, purchaser=purchaser)
 def test_delete_ticket_with_transactions(self):
     '''
         Attempt to delete a ticket item that has a transaction
         Get a failure, return to edit page
     '''
     delete_ticket = self.get_ticketitem_form()
     delete_ticket['title'] = "Delete Title"
     delete_ticket['delete_item'] = ''
     transaction = TransactionFactory(ticket_item=self.ticketitem)
     transaction.save()
     login_as(self.privileged_user, self)
     response = self.client.post(self.url, data=delete_ticket, follow=True)
     self.assertEqual(response.status_code, 200)
     self.assertContains(response, 'Edit Ticket Item')
     self.assertContains(response, delete_ticket_fail_message)
     self.assertContains(response, self.ticketitem.title)
    def test_both_match(self):
        '''
            profile meets role and ticket
        '''
        teacher = PersonaFactory()
        booking = book_worker_item_for_role(teacher, self.role_condition.role)
        conference = booking.event.eventitem.get_conference()

        purchaser = PurchaserFactory(
            matched_to_user=teacher.performer_profile.user_object)
        transaction = TransactionFactory(purchaser=purchaser)
        transaction.ticket_item.ticketing_event.conference = conference
        transaction.ticket_item.ticketing_event.save()
        self.ticket_condition.tickets.add(transaction.ticket_item)
        self.ticket_condition.save()

        self.schedule = get_schedule(teacher.performer_profile.user_object,
                                     labels=[conference.conference_slug
                                             ]).schedule_items
        ticket_items, role_items = get_checklist_items(
            teacher.performer_profile, conference, self.schedule)
        nt.assert_equal(len(ticket_items), 1)
        nt.assert_equal(len(role_items), 1)
        nt.assert_equal(ticket_items[0]['ticket'],
                        transaction.ticket_item.title)
        nt.assert_equal(role_items[self.role_condition.role],
                        [self.role_condition.checklistitem])
示例#6
0
def make_vendor_app_purchase(conference, user_object):
    ticketing_event = TicketingEventsFactory(conference=conference,
                                             vendor_submission_event=True)
    purchaser = PurchaserFactory(matched_to_user=user_object)
    ticket_id = "%s-1111" % (ticketing_event.event_id)
    ticket = TicketItemFactory(ticket_id=ticket_id,
                               ticketing_event=ticketing_event)
    transaction = TransactionFactory(ticket_item=ticket, purchaser=purchaser)
    return transaction
示例#7
0
def make_admission_purchase(conference,
                            user_object,
                            include_most=False,
                            include_conference=False):
    bpt_event = BrownPaperEventsFactory(conference=conference,
                                        include_most=include_most,
                                        include_conference=include_conference)
    purchaser = PurchaserFactory(matched_to_user=user_object)
    ticket_id = "%s-1111" % (bpt_event.bpt_event_id)
    ticket = TicketItemFactory(ticket_id=ticket_id, bpt_event=bpt_event)
    transaction = TransactionFactory(ticket_item=ticket, purchaser=purchaser)
 def test_event_edit_post_delete_event_fail(self):
     transaction = TransactionFactory(
         ticket_item__ticketing_event=self.ticketing_event)
     url = reverse('bptevent_edit',
                   urlconf='ticketing.urls',
                   args=[self.ticketing_event.pk])
     login_as(self.privileged_user, self)
     data = self.get_bptevent_form()
     data['delete_item'] = True
     response = self.client.post(url, data=data, follow=True)
     self.assertContains(response, "Edit Ticketed Event")
     self.assertContains(response, delete_event_fail_message)
    def test_buys_each_year(self):
        '''should get current and upcoming conference tickets, including fees
        '''
        purchase = TransactionFactory()
        purchase.ticket_item.title = "ZZZZ Last Title"
        purchase.ticket_item.save()
        conference = purchase.ticket_item.bpt_event.conference
        TransactionFactory(purchaser=purchase.purchaser,
                           ticket_item__bpt_event__conference=conference)
        TransactionFactory(purchaser=purchase.purchaser,
                           ticket_item__bpt_event__conference=conference)
        old_purchase = TransactionFactory(purchaser=purchase.purchaser)
        old_purchase.ticket_item.bpt_event.conference.status = "ongoing"
        old_purchase.ticket_item.bpt_event.conference.save()
        ticket_set = get_purchased_tickets(purchase.purchaser.matched_to_user)

        self.assertEqual(len(ticket_set), 2)
        self.assertEqual(ticket_set[0]['conference'].status, "ongoing")
        self.assertEqual(ticket_set[1]['conference'].status, "upcoming")
        self.assertEqual(len(ticket_set[0]['tickets']), 1)
        self.assertEqual(len(ticket_set[1]['tickets']), 3)
    def test_no_checklist(self):
        '''
            profile matches no conditions
        '''
        no_match_profile = ProfileFactory()
        transaction = TransactionFactory()
        self.ticket_condition.tickets.add(transaction.ticket_item)
        ticket_items, role_items = get_checklist_items(
            no_match_profile, transaction.ticket_item.bpt_event.conference)

        nt.assert_equal(len(ticket_items), 0)
        nt.assert_equal(len(role_items), 0)
    def test_ticket_match(self):
        '''
            profile has a ticket match condition
        '''
        transaction = TransactionFactory()
        purchaser = ProfileFactory(
            user_object=transaction.purchaser.matched_to_user)
        conference = transaction.ticket_item.bpt_event.conference
        self.ticket_condition.tickets.add(transaction.ticket_item)
        self.ticket_condition.save()

        ticket_items, role_items = get_checklist_items(purchaser, conference)

        nt.assert_equal(len(ticket_items), 1)
        nt.assert_equal(ticket_items[0]['items'],
                        [self.ticket_condition.checklistitem])
    def test_no_checklist(self):
        '''
            profile matches no conditions
        '''
        no_match_profile = ProfileFactory()
        transaction = TransactionFactory()
        conf = transaction.ticket_item.ticketing_event.conference
        self.ticket_condition.tickets.add(transaction.ticket_item)
        no_schedule = get_schedule(no_match_profile.user_object,
                                   labels=[conf.conference_slug
                                           ]).schedule_items
        ticket_items, role_items = get_checklist_items(
            no_match_profile,
            transaction.ticket_item.ticketing_event.conference, no_schedule)

        nt.assert_equal(len(ticket_items), 0)
        nt.assert_equal(len(role_items), 0)
示例#13
0
    def test_multiple_ticket_match_happens(self):
        '''
            feeding in the matching ticket, gives an item
        '''
        match_condition = TicketingEligibilityConditionFactory(
            tickets=[self.transaction.ticket_item])
        another_transaction = TransactionFactory(
            purchaser=self.transaction.purchaser,
            ticket_item=self.transaction.ticket_item)

        checklist_items = get_checklist_items_for_tickets(
            self.purchaser, self.conference,
            [self.transaction.ticket_item, another_transaction.ticket_item])
        nt.assert_equal(len(checklist_items), 1)
        nt.assert_equal(checklist_items[0]['count'], 2)
        nt.assert_equal(checklist_items[0]['ticket'],
                        self.transaction.ticket_item.title)
        nt.assert_equal(checklist_items[0]['items'],
                        [match_condition.checklistitem])
示例#14
0
 def __init__(self,
              profile=None,
              conference=None,
              bpt_event=None,
              ticket=None):
     self.transaction = TransactionFactory(
         ticket_item__bpt_event__badgeable=True)
     if profile:
         self.profile = profile
         # the order of setting this line matters - see test_reports - BB
         self.transaction.purchaser.matched_to_user = \
             self.profile.user_object
         self.transaction.purchaser.save()
     else:
         self.profile = ProfileFactory(
             user_object=self.transaction.purchaser.matched_to_user)
     if conference:
         self.conference = conference
     else:
         self.conference = ConferenceFactory()
示例#15
0
 def test_w_ticket_condition_only_purchaser(self):
     '''loads with the default conference selection.
     '''
     transaction = TransactionFactory(
         ticket_item__ticketing_event__conference=self.class_context.
         conference, )
     ticket_condition = TicketingEligibilityConditionFactory(
         checklistitem__badge_title="Badge Name")
     ticket_condition.tickets.add(transaction.ticket_item)
     login_as(self.privileged_user, self)
     response = self.client.get(self.url)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.get('Content-Disposition'),
                      "attachment; filename=print_badges.csv")
     self.assertContains(
         response,
         "First,Last,username,Badge Name,Badge Type,Ticket Purchased,Date")
     self.assertContains(response,
                         transaction.purchaser.matched_to_user.username)
     self.assertContains(response, transaction.purchaser.first_name, 2)
     self.assertContains(response, transaction.ticket_item.title)
     self.assertContains(response, "Badge Name")
示例#16
0
    def test_ticket_purchase(self):
        '''a ticket purchaser gets a checklist item
        '''
        transaction = TransactionFactory()
        purchaser = ProfileFactory(
            user_object=transaction.purchaser.matched_to_user)
        conference = transaction.ticket_item.bpt_event.conference
        ticket_condition = TicketingEligibilityConditionFactory(
            tickets=[transaction.ticket_item])
        context = ClassContext(
            conference=transaction.ticket_item.bpt_event.conference)
        context.set_interest(interested_profile=purchaser)

        request = self.factory.get('reports/schedule_all?conf_slug=' +
                                   conference.conference_slug)
        login_as(self.priv_profile, self)
        response = self.client.get(
            self.url, data={"conf_slug": conference.conference_slug})
        self.assertEqual(response.status_code, 200)
        nt.assert_true(str(purchaser) in response.content,
                       msg="Buyer is not in the list")
        nt.assert_true(str(ticket_condition.checklistitem) in response.content)
示例#17
0
    def test_ticket_purchase_solo_profile(self):
        '''a ticket purchaser gets a checklist item
        '''
        transaction = TransactionFactory()
        purchaser = ProfileFactory(
            user_object=transaction.purchaser.matched_to_user)
        conference = transaction.ticket_item.ticketing_event.conference
        ticket_condition = TicketingEligibilityConditionFactory(
            tickets=[transaction.ticket_item])

        request = self.factory.get('reports/schedule_all?conf_slug=' +
                                   conference.conference_slug)
        login_as(self.priv_profile, self)
        response = self.client.get(
            reverse('welcome_letter',
                    urlconf='gbe.reporting.urls',
                    args=[purchaser.pk]),
            data={"conf_slug": conference.conference_slug})
        self.assertEqual(response.status_code, 200)
        self.assertContains(response,
                            str(purchaser),
                            msg_prefix="Buyer is not in the list")
        self.assertContains(response, str(ticket_condition.checklistitem))
示例#18
0
 def setUp(self):
     self.ticketingcondition = TicketingEligibilityConditionFactory()
     self.transaction = TransactionFactory()
     self.purchaser = ProfileFactory(
         user_object=self.transaction.purchaser.matched_to_user)
     self.conference = self.transaction.ticket_item.bpt_event.conference