Example #1
0
    def test_get_tickets_for_class(self):
        '''get one ticket for everything but master, and one for classes
        '''
        event = ClassFactory()
        ws_bpt_event = BrownPaperEventsFactory(
            conference=event.e_conference,
            include_most=True,
            title="The Whole Shebang 2016")
        sch_bpt_event = BrownPaperEventsFactory(
            conference=event.e_conference,
            include_conference=True,
            title="The Scholar 2016")
        whole_shebang = TicketItemFactory(
            bpt_event=ws_bpt_event,
            live=True,
            has_coupon=False)
        scholar = TicketItemFactory(
            bpt_event=sch_bpt_event,
            live=True,
            has_coupon=False)
        tickets = event.get_tickets()

        self.assertEqual(len(tickets), 2)
        self.assertEqual(
            tickets[0],
            ws_bpt_event)
        self.assertEqual(
            tickets[1],
            sch_bpt_event)
 def test_get_ticketing_eligibility_edit_ticket_exclude(self):
     ticket = TicketItemFactory()
     ticket2 = TicketItemFactory(ticketing_event__title=None)
     ticket3 = TicketItemFactory()
     match_condition = TicketingEligibilityConditionFactory(
         tickets=[ticket])
     exclusion = TicketingExclusionFactory(condition=match_condition,
                                           tickets=[ticket2, ticket3])
     response = self.client.get(reverse(
         "admin:ticketing_ticketingeligibilitycondition_change",
         args=(match_condition.id, )),
                                follow=True)
     self.assertContains(response, "%s, %s" % (ticket2, ticket3))
 def test_get_ticketing_eligibility_cond_changelist(self):
     ticket = TicketItemFactory()
     ticket2 = TicketItemFactory()
     ticket3 = TicketItemFactory()
     match_condition = TicketingEligibilityConditionFactory(
         tickets=[ticket])
     exclusion = TicketingExclusionFactory(condition=match_condition,
                                           tickets=[ticket2, ticket3])
     response = self.client.get(reverse(
         "admin:ticketing_ticketingeligibilitycondition_changelist"),
                                follow=True)
     self.assertContains(response,
                         match_condition.checklistitem.description)
    def test_get_transaction_purchase_email(self, m_urlopen):
        '''
           get a transaction for a real user via the purchase_email
        '''
        BrownPaperEvents.objects.all().delete()
        BrownPaperSettings.objects.all().delete()
        event = BrownPaperEventsFactory()
        ticket = TicketItemFactory(bpt_event=event,
                                   ticket_id='%s-%s' %
                                   (event.bpt_event_id, '3255985'))
        BrownPaperSettingsFactory()
        profile = ProfileFactory(purchase_email='*****@*****.**')

        a = Mock()
        order_filename = open("tests/ticketing/orderlist.xml", 'r')
        a.read.side_effect = [File(order_filename).read()]
        m_urlopen.return_value = a

        nt.assert_equal(process_bpt_order_list(), 1)
        transaction = get_object_or_404(Transaction, reference='A12345678')
        nt.assert_equal(str(transaction.order_date),
                        "2014-08-16 00:26:56+00:00")
        nt.assert_equal(transaction.shipping_method, 'Will Call')
        nt.assert_equal(transaction.order_notes, 'None')
        nt.assert_equal(transaction.payment_source, 'Brown Paper Tickets')
        nt.assert_equal(transaction.purchaser.email, '*****@*****.**')
        nt.assert_equal(transaction.purchaser.phone, '111-222-3333')
        nt.assert_equal(transaction.purchaser.matched_to_user,
                        profile.user_object)
        nt.assert_equal(transaction.purchaser.first_name, 'John')
        nt.assert_equal(transaction.purchaser.last_name, 'Smith')
        profile.user_object.delete()
    def test_reimport_bpt_inventory(self, m_urlopen):
        # reimporting gets nothing new but doesn't fail
        TicketingEvents.objects.all().delete()
        BrownPaperSettings.objects.all().delete()
        event = TicketingEventsFactory()
        BrownPaperSettingsFactory()
        TicketItemFactory(ticket_id='%s-4513068' % (event.event_id),
                          has_coupon=True,
                          live=False,
                          ticketing_event=event)
        a = Mock()
        date_filename = open("tests/ticketing/datelist.xml", 'r')
        price_filename = open("tests/ticketing/pricelist.xml", 'r')
        a.read.side_effect = [
            File(date_filename).read(),
            File(price_filename).read()
        ]
        m_urlopen.return_value = a

        response = self.import_tickets()
        self.assertEqual(response.status_code, 200)
        ticket = get_object_or_404(TicketItem,
                                   ticket_id='%s-4513068' % (event.event_id))
        assert ticket.live
        assert ticket.has_coupon
Example #6
0
    def test_get_transaction_limbo(self, m_urlopen):
        '''
           get a transaction for the limbo user
        '''
        TicketingEvents.objects.all().delete()
        BrownPaperSettings.objects.all().delete()
        event = TicketingEventsFactory()
        ticket = TicketItemFactory(ticketing_event=event,
                                   ticket_id='%s-%s' %
                                   (event.event_id, '3255985'))
        BrownPaperSettingsFactory()
        limbo, created = User.objects.get_or_create(username='******')

        a = Mock()
        order_filename = open("tests/ticketing/orderlist.xml", 'r')
        a.read.side_effect = [File(order_filename).read()]
        m_urlopen.return_value = a

        self.assertEqual(process_bpt_order_list(), 1)
        transaction = get_object_or_404(Transaction, reference='A12345678')
        self.assertEqual(str(transaction.order_date), "2014-08-15 19:26:56")
        self.assertEqual(transaction.shipping_method, 'Will Call')
        self.assertEqual(transaction.order_notes, 'None')
        self.assertEqual(transaction.payment_source, 'Brown Paper Tickets')
        self.assertEqual(transaction.purchaser.email, '*****@*****.**')
        self.assertEqual(transaction.purchaser.phone, '111-222-3333')
        self.assertEqual(transaction.purchaser.matched_to_user, limbo)
        self.assertEqual(transaction.purchaser.first_name, 'John')
        self.assertEqual(transaction.purchaser.last_name, 'Smith')
 def test_ticket_is_excluded(self):
     '''
        a ticket in the held tickets matches the exclusion set
     '''
     problem_ticket = TicketItemFactory.create()
     self.ticketingexclusion.tickets.add(problem_ticket)
     nt.assert_true(self.ticketingexclusion.is_excluded([problem_ticket]))
Example #8
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)
Example #9
0
    def test_transactions_sync_bpt_only(self, m_urlopen):
        TicketingEvents.objects.all().delete()
        BrownPaperSettings.objects.all().delete()
        BrownPaperSettingsFactory()
        event = TicketingEventsFactory(event_id="1")
        ticket = TicketItemFactory(ticketing_event=event,
                                   ticket_id='%s-%s' %
                                   (event.event_id, '3255985'))

        limbo, created = User.objects.get_or_create(username='******')

        a = Mock()
        order_filename = open("tests/ticketing/orderlist.xml", 'r')
        a.read.side_effect = [File(order_filename).read()]
        m_urlopen.return_value = a

        login_as(self.privileged_user, self)
        response = self.client.post(self.url, data={'Sync': 'Sync'})
        nt.assert_equal(response.status_code, 200)

        transaction = get_object_or_404(Transaction, reference='A12345678')
        nt.assert_equal(str(transaction.order_date), "2014-08-15 19:26:56")
        nt.assert_equal(transaction.shipping_method, 'Will Call')
        nt.assert_equal(transaction.order_notes, 'None')
        nt.assert_equal(transaction.payment_source, 'Brown Paper Tickets')
        nt.assert_equal(transaction.purchaser.email, '*****@*****.**')
        nt.assert_equal(transaction.purchaser.phone, '111-222-3333')
        nt.assert_equal(transaction.purchaser.matched_to_user, limbo)
        nt.assert_equal(transaction.purchaser.first_name, 'John')
        nt.assert_equal(transaction.purchaser.last_name, 'Smith')
        assert_alert_exists(
            response, 'success', 'Success',
            "%s   Transactions imported: %s - BPT" %
            (import_transaction_message, "1"))
        assert_alert_exists(response, 'danger', 'Error', no_settings_error)
Example #10
0
def make_act_app_ticket(conference):
    ticketing_event = TicketingEventsFactory(conference=conference,
                                             act_submission_event=True)
    ticket_id = "%s-1111" % (ticketing_event.event_id)
    ticket = TicketItemFactory(ticket_id=ticket_id,
                               ticketing_event=ticketing_event)
    return ticketing_event.event_id
Example #11
0
    def test_reimport_inventory(self, m_urlopen):
        '''
           privileged user gets the inventory of tickets from (fake) BPT
        '''
        BrownPaperEvents.objects.all().delete()
        BrownPaperSettings.objects.all().delete()
        event = BrownPaperEventsFactory()
        BrownPaperSettingsFactory()
        TicketItemFactory(
            ticket_id='%s-4513068' % (event.bpt_event_id),
            has_coupon=True,
            live=False,
            bpt_event=event)
        a = Mock()
        date_filename = open("tests/ticketing/datelist.xml", 'r')
        price_filename = open("tests/ticketing/pricelist.xml", 'r')
        a.read.side_effect = [File(date_filename).read(),
                              File(price_filename).read()]
        m_urlopen.return_value = a

        response = self.import_tickets()
        nt.assert_equal(response.status_code, 200)
        ticket = get_object_or_404(
            TicketItem,
            ticket_id='%s-4513068' % (event.bpt_event_id))
        assert ticket.live
        assert ticket.has_coupon
Example #12
0
def setup_fees(conference, is_act=False, is_vendor=False):
    PayPalSettingsFactory()
    event = TicketingEventsFactory(conference=conference,
                                   vendor_submission_event=is_vendor,
                                   act_submission_event=is_act)
    if is_vendor:
        ticket = TicketItemFactory(live=True, ticketing_event=event)
        add_on = TicketItemFactory(live=True,
                                   ticketing_event=event,
                                   add_on=True)
        return [ticket, add_on]
    if is_act:
        ticket = TicketItemFactory(live=True,
                                   ticketing_event=event,
                                   is_minimum=True,
                                   cost=10)
        return [ticket]
 def test_condition_role_exclusion(self):
     '''
         condition has a role exclusion, and no tickets are provided
     '''
     problem_ticket = TicketItemFactory.create()
     self.ticketingexclusion.tickets.add(problem_ticket)
     nt.assert_true(
         self.roleexclusion.condition.is_excluded([], self.schedule))
Example #14
0
 def test_ticket_is_excluded(self):
     '''
        a ticket in the held tickets matches the exclusion set
     '''
     problem_ticket = TicketItemFactory.create()
     self.ticketingexclusion.tickets.add(problem_ticket)
     nt.assert_true(
         self.ticketingexclusion.is_excluded([problem_ticket]))
 def test_get_ticketing_eligibility(self):
     ticket = TicketItemFactory()
     match_condition = TicketingEligibilityConditionFactory(
         tickets=[ticket])
     response = self.client.get(
         '/admin/ticketing/ticketingeligibilitycondition/', follow=True)
     self.assertContains(response, ticket.ticketing_event.title)
     self.assertContains(response, ticket.title)
Example #16
0
 def test_condition_role_exclusion(self):
     '''
         condition has a role exclusion, and no tickets are provided
     '''
     problem_ticket = TicketItemFactory.create()
     self.ticketingexclusion.tickets.add(problem_ticket)
     nt.assert_true(
         self.roleexclusion.condition.is_excluded(
             [], self.teacher.performer_profile, self.conference))
Example #17
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
 def test_condition_ticket_exclusion(self):
     '''
         condition has a ticketing exclusion, which is triggered
     '''
     problem_ticket = TicketItemFactory.create()
     self.ticketingexclusion.tickets.add(problem_ticket)
     nt.assert_true(
         self.ticketingexclusion.condition.is_excluded([problem_ticket],
                                                       self.schedule))
 def test_get_only_special_form(self):
     reg_ticket = TicketItemFactory(ticket_id="%s-22222" %
                                    (self.ticketing_event.event_id),
                                    ticketing_event=self.ticketing_event,
                                    special_comp=False)
     login_as(self.privileged_user, self)
     response = self.client.get(self.url)
     self.assertNotContains(response, str(reg_ticket.title))
     self.assertContains(response, str(self.ticket))
 def setUp(self):
     self.client = Client()
     self.ticketitem = TicketItemFactory.create()
     self.privileged_user = ProfileFactory.create().\
         user_object
     grant_privilege(self.privileged_user, 'Ticketing - Admin')
     self.url = reverse(self.view_name,
                        args=[self.ticketitem.pk],
                        urlconf='ticketing.urls')
Example #21
0
 def test_only_visible_ticket(self):
     '''
        user gets the list
     '''
     not_shown = TicketItemFactory(
         live=False,
         cost=999.99,
         bpt_event__title='This is the Event Title')
     also_not_shown = TicketItemFactory(
         has_coupon=True,
         cost=not_shown.cost,
         bpt_event__title=not_shown.bpt_event)
     ticket = TicketItemFactory(live=True,
                                bpt_event=not_shown.bpt_event,
                                cost=123.00)
     response = self.client.get(self.url)
     assert 'This is the Event Title' in response.content
     assert str(not_shown.cost) not in response.content
     assert str(ticket.cost) in response.content
Example #22
0
 def test_condition_ticket_exclusion(self):
     '''
         condition has a ticketing exclusion, which is triggered
     '''
     problem_ticket = TicketItemFactory.create()
     self.ticketingexclusion.tickets.add(problem_ticket)
     nt.assert_true(
         self.ticketingexclusion.condition.is_excluded(
             [problem_ticket], self.teacher.performer_profile,
             self.conference))
Example #23
0
 def test_condition_role_exclusion(self):
     '''
         condition has a role exclusion, and no tickets are provided
     '''
     problem_ticket = TicketItemFactory.create()
     self.ticketingexclusion.tickets.add(problem_ticket)
     nt.assert_true(self.roleexclusion.condition.is_excluded(
         [],
         self.teacher.performer_profile,
         self.conference))
Example #24
0
 def setUp(self):
     self.client = Client()
     self.privileged_user = ProfileFactory.create().user_object
     grant_privilege(self.privileged_user, 'Ticketing - Admin',
                     'view_checklistitem')
     self.url = reverse(self.view_name, urlconf='ticketing.urls')
     self.role_condition = RoleEligibilityConditionFactory()
     self.ticket_condition = TicketingEligibilityConditionFactory()
     self.ticket_item = TicketItemFactory()
     self.ticket_condition.tickets.add(self.ticket_item)
Example #25
0
 def test_two_tickets_one_event(self):
     second_ticket_item = TicketItemFactory(
         ticketing_event=self.ticket_item.ticketing_event)
     self.ticket_condition.tickets.add(second_ticket_item)
     login_as(self.privileged_user, self)
     response = self.client.get(self.url)
     self.assertContains(response, self.ticket_item.title)
     self.assertContains(response, self.ticket_item.ticketing_event.title)
     self.assertContains(response, second_ticket_item.title)
     self.assertContains(response, second_ticket_item.ticketing_event.title)
 def test_only_visible_ticket(self):
     '''
        user gets the list
     '''
     not_shown = TicketItemFactory(
         live=False,
         cost=999.99,
         ticketing_event__title='This is the Event Title')
     also_not_shown = TicketItemFactory(
         has_coupon=True,
         cost=not_shown.cost,
         ticketing_event__title=not_shown.ticketing_event)
     ticket = TicketItemFactory(live=True,
                                ticketing_event=not_shown.ticketing_event,
                                cost=123.00)
     response = self.client.get(self.url)
     self.assertContains(response, 'This is the Event Title')
     self.assertNotContains(response, str(not_shown.cost))
     self.assertContains(response, str(ticket.cost))
    def test_ticket_linked_event(self):
        active_ticket = TicketItemFactory(live=True)
        gbe_event = ShowFactory(
            e_conference=active_ticket.ticketing_event.conference)
        active_ticket.ticketing_event.linked_events.add(gbe_event)
        active_ticket.ticketing_event.save()
        url = reverse(self.view_name, urlconf='ticketing.urls')
        login_as(self.privileged_user, self)
        response = self.client.get(url)

        self.assertEqual(response.status_code, 200)
Example #28
0
    def test_get_tickets_nothing_active(self):
        '''the ticket is linked to the class and there are two active prices
        only the most expensive is shown
        '''
        event = ClassFactory()
        ticketing_event = TicketingEventsFactory(conference=event.e_conference,
                                                 include_conference=True)
        TicketItemFactory(ticketing_event=ticketing_event,
                          live=False,
                          has_coupon=False,
                          title="The Whole Shebang 2016")
        TicketItemFactory(ticketing_event=ticketing_event,
                          live=True,
                          has_coupon=True,
                          cost=299.99,
                          title="The Whole Shebang 2016 - expensive")

        tickets = event.get_tickets()

        self.assertEqual(len(tickets), 0)
Example #29
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_ticket_active_state(self):
        # privileged user gets the list for a conference
        at = TicketItemFactory(live=True)
        not_live_ticket = TicketItemFactory(live=False,
                                            ticketing_event=at.ticketing_event)
        coupon_ticket = TicketItemFactory(has_coupon=True,
                                          live=True,
                                          ticketing_event=at.ticketing_event)

        url = reverse(self.view_name, urlconf='ticketing.urls')
        login_as(self.privileged_user, self)
        response = self.client.get(
            url,
            data={"conference": at.ticketing_event.conference.conference_slug})

        self.assertEqual(response.status_code, 200)
        self.assertContains(response, 'Visible')
        self.assertContains(response, 'Hidden')
        self.assertContains(response, 'Requires Coupon')
        self.assertContains(response, 'Regular Fee', 3)
 def test_get_ticketing_eligibility_edit_role_exclude_event(self):
     ticket = TicketItemFactory()
     match_condition = TicketingEligibilityConditionFactory(
         tickets=[ticket])
     exclusion = RoleExclusionFactory(condition=match_condition,
                                      role="Performer")
     response = self.client.get(reverse(
         "admin:ticketing_ticketingeligibilitycondition_change",
         args=(match_condition.id, )),
                                follow=True)
     self.assertContains(response, "Performer in %s" % exclusion.event)
 def test_list_tickets_for_conf(self):
     # privileged user gets the list for a conference
     t = TicketItemFactory()
     url = reverse(self.view_name, urlconf='ticketing.urls')
     login_as(self.privileged_user, self)
     response = self.client.get(
         url,
         data={"conference": t.ticketing_event.conference.conference_slug})
     self.assertEqual(response.status_code, 200)
     self.assertContains(response, "All Conference Classes")
     self.assertNotContains(response, "fas fa-check")
Example #33
0
 def test_condition_ticket_exclusion(self):
     '''
         condition has a ticketing exclusion, which is triggered
     '''
     problem_ticket = TicketItemFactory.create()
     self.ticketingexclusion.tickets.add(problem_ticket)
     nt.assert_true(
         self.ticketingexclusion.condition.is_excluded(
             [problem_ticket],
             self.teacher.performer_profile,
             self.conference
             ))
Example #34
0
 def test_no_ticket_excluded(self):
     '''
         the ticket is not in the excluded set
     '''
     diff_ticket = TicketItemFactory.create()
     nt.assert_false(self.ticketingexclusion.is_excluded([diff_ticket]))