コード例 #1
0
    def test_transactions_sync_ticket_missing(self, m_eventbrite):
        TicketingEvents.objects.all().delete()
        BrownPaperSettings.objects.all().delete()
        EventbriteSettings.objects.all().delete()
        SyncStatus.objects.all().delete()
        BrownPaperSettingsFactory()
        EventbriteSettingsFactory()
        event = TicketingEventsFactory(event_id="1", source=2)

        m_eventbrite.return_value = order_dict

        login_as(self.privileged_user, self)
        response = self.client.post(self.url, data={'Sync': 'Sync'})
        assert_alert_exists(response, 'danger', 'Error',
                            "Ticket Item for id 3255985 does not exist")
        error_status = SyncStatus.objects.filter(is_success=False).first()
        success_status = SyncStatus.objects.filter(is_success=True).first()
        self.assertEqual(error_status.error_msg,
                         "Ticket Item for id 3255985 does not exist")
        self.assertEqual(success_status.import_type, "EB Transaction")
        self.assertEqual(success_status.import_number, 0)
コード例 #2
0
    def test_transactions_sync_eb_pagination(self, m_eventbrite):
        TicketingEvents.objects.all().delete()
        BrownPaperSettings.objects.all().delete()
        EventbriteSettings.objects.all().delete()
        BrownPaperSettingsFactory()
        EventbriteSettingsFactory()
        event = TicketingEventsFactory(event_id="1", source=2)
        ticket = TicketItemFactory(ticketing_event=event, ticket_id='3255985')

        limbo, created = User.objects.get_or_create(username='******')
        continue_order_page = copy.deepcopy(order_dict)
        continue_order_page['pagination']['has_more_items'] = True
        continue_order_page['pagination']['continuation'] = "eyJwYWdlIjogMn0"
        m_eventbrite.side_effect = [continue_order_page, order_dict]

        login_as(self.privileged_user, self)
        response = self.client.post(self.url, data={'Sync': 'Sync'})
        assert_alert_exists(
            response, 'success', 'Success',
            "%s  Transactions imported: %d -- Eventbrite" %
            (import_transaction_message, 1))
コード例 #3
0
    def test_transactions_sync_eb_only(self, m_eventbrite):
        TicketingEvents.objects.all().delete()
        BrownPaperSettings.objects.all().delete()
        EventbriteSettings.objects.all().delete()
        SyncStatus.objects.all().delete()
        BrownPaperSettingsFactory(active_sync=False)
        EventbriteSettingsFactory()
        event = TicketingEventsFactory(event_id="1", source=2)
        ticket = TicketItemFactory(ticketing_event=event, ticket_id='3255985')

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

        login_as(self.privileged_user, self)
        response = self.client.post(self.url, data={'Sync': 'Sync'})
        assert_alert_exists(
            response, 'success', 'Success',
            "%s  Transactions imported: %d -- Eventbrite" %
            (import_transaction_message, 1))
        success_status = SyncStatus.objects.filter(is_success=True).first()
        self.assertEqual(success_status.import_type, "EB Transaction")
        self.assertEqual(success_status.import_number, 1)
コード例 #4
0
    def test_get_eb_inventory(self, m_eventbrite):
        # privileged user gets the inventory of tickets from (fake) EB
        TicketingEvents.objects.all().delete()
        BrownPaperSettings.objects.all().delete()
        event = TicketingEventsFactory()
        BrownPaperSettingsFactory()
        EventbriteSettingsFactory()

        m_eventbrite.side_effect = [
            event_dict, ticket_dict1, ticket_dict2, ticket_dict3
        ]

        response = self.import_tickets()
        assert_alert_exists(response, 'success', 'Success',
                            ("Successfully imported %d events, %d tickets") %
                            (3, 6))
        assert_alert_exists(response, 'success', 'Success',
                            ("BPT: imported %d tickets") % (0))
        ticket = get_object_or_404(TicketItem, ticket_id='987987987')
        self.assertEqual(ticket.cost, Decimal('0.00'))
        ticket = get_object_or_404(TicketItem, ticket_id='098098098')
        self.assertEqual(ticket.cost, Decimal('100.00'))
コード例 #5
0
ファイル: test_list_tickets.py プロジェクト: bethlakshmi/GBE2
    def test_get_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()

        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))
        nt.assert_equal(response.status_code, 200)
        nt.assert_equal(ticket.cost, Decimal('125.00'))
コード例 #6
0
 def test_make_and_sync_new_ticket(self, m_urlopen):
     grant_privilege(self.privileged_user, 'Ticketing - Admin')
     TicketingEvents.objects.all().delete()
     BrownPaperSettings.objects.all().delete()
     BrownPaperSettingsFactory()
     ticketing_event = TicketingEventsFactory(
         conference=self.current_conference)
     a = Mock()
     event_filename = open("tests/ticketing/eventlist.xml", 'r')
     date_filename = open("tests/ticketing/datelist.xml", 'r')
     price_filename = open("tests/ticketing/pricelist.xml", 'r')
     a.read.side_effect = [
         File(event_filename).read(),
         File(date_filename).read(),
         File(price_filename).read()
     ]
     m_urlopen.return_value = a
     login_as(self.privileged_user, self)
     data = self.edit_class()
     data['event_id'] = "1122333"
     data['display_icon'] = "icon-diamond"
     response = self.client.post(self.url, data=data, follow=True)
     new_class = GenericEvent.objects.get(e_title=data['e_title'])
     self.assertEqual(new_class.type, "Master")
     occurrence = Event.objects.get(
         eventitem__eventitem_id=new_class.eventitem_id)
     self.assertRedirects(
         response, "%s?%s-day=%d&filter=Filter&new=[%d]" %
         (reverse('manage_event_list',
                  urlconf='gbe.scheduling.urls',
                  args=[self.current_conference.conference_slug
                        ]), self.current_conference.conference_slug,
          self.day.pk, occurrence.pk))
     assert_alert_exists(
         response, 'success', 'Success',
         "%s %s - %s" % (create_ticket_event_success_msg, data['event_id'],
                         "GBE10 Whole Shebang 2016"))
コード例 #7
0
    def test_get_transaction_user_by_id(self, m_urlopen):
        '''
           get a transaction for a real user with transaction id match
        '''
        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().replace(
                'tracker12345', 'ID-' + str(profile.user_object.pk))
        ]
        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()