예제 #1
0
    def test_get_tickets_for_master_class(self):
        '''get the one ticket that is active for the Master Class
        '''
        event = GenericEventFactory(type='Master')
        ticketing_event = TicketingEventsFactory(conference=event.e_conference,
                                                 title="Master Class 2017")
        ticketing_event.linked_events.add(event)
        ticketing_event.save()
        TicketItemFactory(ticketing_event=ticketing_event,
                          live=True,
                          has_coupon=False)
        tickets = event.get_tickets()

        self.assertEqual(len(tickets), 1)
        self.assertEqual(tickets[0].title, "Master Class 2017")
예제 #2
0
    def test_get_tickets_for_class_three_ways(self):
        '''the ticket is linked to the class event three ways - 'most',
        'conference', and a direct link.  It only should appear once.
        '''
        event = ClassFactory()
        ticketing_event = TicketingEventsFactory(
            conference=event.e_conference,
            include_most=True,
            include_conference=True,
            title="The Whole Shebang 2016")
        ticketing_event.linked_events.add(event)
        ticketing_event.save()
        TicketItemFactory(ticketing_event=ticketing_event,
                          live=True,
                          has_coupon=False)

        tickets = event.get_tickets()
        self.assertEqual(len(tickets), 1)
        self.assertEqual(tickets[0].title, "The Whole Shebang 2016")
예제 #3
0
class TestEditBPTEvent(TestCase):
    '''Tests for bptevent_edit view'''

    def setUp(self):
        self.client = Client()
        self.ticketing_event = TicketingEventsFactory()
        self.gbe_event = ShowFactory()
        self.privileged_user = ProfileFactory().user_object
        grant_privilege(self.privileged_user, 'Ticketing - Admin')
        self.url = reverse('set_ticket_to_event',
                           urlconf='ticketing.urls',
                           args=[self.ticketing_event.event_id,
                                 "on",
                                 self.gbe_event.eventitem_id])

    def test_use_user_is_not_ticketing(self):
        user = ProfileFactory.create().user_object
        login_as(user, self)
        response = self.client.get(self.url)
        self.assertEqual(403, response.status_code)

    def test_set_link_on(self):
        login_as(self.privileged_user, self)
        response = self.client.get(self.url, follow=True)
        self.assertRedirects(
            response,
            "%s?conference=%s&open_panel=ticket&updated_events=[%s]" % (
                reverse('ticket_items', urlconf='ticketing.urls'),
                str(self.ticketing_event.conference.conference_slug),
                self.ticketing_event.id))
        self.assertContains(response, link_event_to_ticket_success_msg)

    def test_set_link_off(self):
        self.ticketing_event.linked_events.add(self.gbe_event)
        self.ticketing_event.save()
        self.url = reverse('set_ticket_to_event',
                           urlconf='ticketing.urls',
                           args=[self.ticketing_event.event_id,
                                 "off",
                                 self.gbe_event.eventitem_id])
        login_as(self.privileged_user, self)
        response = self.client.get(self.url, follow=True)
        self.assertRedirects(
            response,
            "%s?conference=%s&open_panel=ticket&updated_events=[%s]" % (
                reverse('ticket_items', urlconf='ticketing.urls'),
                str(self.ticketing_event.conference.conference_slug),
                self.ticketing_event.id))
        self.assertContains(response, unlink_event_to_ticket_success_msg)

    def test_bad_logic(self):
        self.url = reverse('set_ticket_to_event',
                           urlconf='ticketing.urls',
                           args=[self.ticketing_event.event_id,
                                 "off",
                                 self.gbe_event.eventitem_id])
        login_as(self.privileged_user, self)
        response = self.client.get(self.url, follow=True)
        self.assertRedirects(
            response,
            "%s?conference=%s&open_panel=ticket&updated_events=[%s]" % (
                reverse('ticket_items', urlconf='ticketing.urls'),
                str(self.ticketing_event.conference.conference_slug),
                self.ticketing_event.id))
        self.assertNotContains(response, unlink_event_to_ticket_success_msg)
        self.assertNotContains(response, link_event_to_ticket_success_msg)