def test_get_transaction_user(self, m_urlopen):
        '''
           match to a user with no purchase_email, but matching 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()
        user = UserFactory(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,
                        user)
        nt.assert_equal(transaction.purchaser.first_name, 'John')
        nt.assert_equal(transaction.purchaser.last_name, 'Smith')
        user.delete()
    def test_get_transaction_user(self, m_urlopen):
        '''
           match to a user with no purchase_email, but matching 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()
        user = UserFactory(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, user)
        nt.assert_equal(transaction.purchaser.first_name, 'John')
        nt.assert_equal(transaction.purchaser.last_name, 'Smith')
        user.delete()
Ejemplo n.º 3
0
    def test_get_transaction_fake_out(self, m_urlopen):
        '''
           in a case of user email vs. purchase email, purchase wins.
        '''
        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='******')
        user = UserFactory(email='*****@*****.**')
        profile = ProfileFactory(user_object=user,
                                 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

        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')
        user.delete()
Ejemplo n.º 4
0
 def test_review_costume_no_profile(self):
     url = reverse(self.view_name, urlconf="gbe.urls")
     login_as(UserFactory(), self)
     response = self.client.get(
         url,
         data={'conf_slug': self.conference.conference_slug})
     nt.assert_equal(403, response.status_code)
Ejemplo n.º 5
0
 def test_post_update_upload_image(self):
     Image.objects.all().delete()
     UserFactory(username='******')
     image_style = StyleValueImageFactory(
         style_version=self.value.style_version,
         image=set_image(folder_name='Backgrounds'))
     file1 = open("tests/gbe/gbe_pagebanner.png", 'rb')
     login_as(self.user, self)
     response = self.client.post(self.url,
                                 data={
                                     '%s-value_0' % self.value.pk:
                                     "rgba(255,255,255,0)",
                                     '%s-style_property' % self.value.pk:
                                     self.value.style_property.pk,
                                     '%s-style_property' % image_style.pk:
                                     image_style.style_property.pk,
                                     "%s-image" % image_style.pk:
                                     image_style.image.pk,
                                     "%s-add_image" % image_style.pk:
                                     file1,
                                     'update':
                                     "Update",
                                 },
                                 follow=True)
     self.assertContains(response, image_style.style_property.selector)
     self.assertContains(response,
                         image_style.style_property.style_property)
     self.assertContains(
         response,
         '''<input type="radio" name="%s-image" value="%s"
         id="id_%s-image_1" checked>''' %
         (image_style.pk, image_style.image.pk + 1, image_style.pk),
         html=True)
Ejemplo n.º 6
0
 def post_class_proposal(self):
     current_conference()
     url = reverse(self.view_name, urlconf="gbe.urls")
     data = self.get_class_form(valid=True)
     login_as(UserFactory(), self)
     response = self.client.post(url, data=data, follow=True)
     return response
Ejemplo n.º 7
0
 def test_propose_invalid_class(self):
     current_conference()
     url = reverse(self.view_name, urlconf="gbe.urls")
     data = self.get_class_form(valid=False)
     login_as(UserFactory(), self)
     response = self.client.post(url, data=data)
     self.assertEqual(response.status_code, 200)
Ejemplo n.º 8
0
 def test_assign_volunteers_no_profile(self):
     ''' user does not have a profile, permission is denied'''
     volunteer = VolunteerFactory()
     url = reverse(self.view_name, args=[volunteer.pk], urlconf='gbe.urls')
     login_as(UserFactory(), self)
     response = self.client.get(url)
     nt.assert_equal(403, response.status_code)
 def test_no_profile(self):
     url = reverse('home', urlconf="gbe.urls")
     login_as(UserFactory(), self)
     response = self.client.get(url, follow=True)
     self.assertRedirects(response, '%s?next=%s' % (
         reverse('profile_update', urlconf="gbe.urls"),
         url))
Ejemplo n.º 10
0
 def test_review_volunteer_no_profile(self):
     ''' user does not have a profile, gets permission denied'''
     login_as(UserFactory(), self)
     response = self.client.get(
         self.url,
         {'conf_slug': self.volunteer.b_conference.conference_slug})
     nt.assert_equal(response.status_code, 403)
Ejemplo n.º 11
0
 def test_conference_volunteer_no_profile(self):
     ClassProposal.objects.all().delete()
     proposal = ClassProposalFactory(display=False)
     url = reverse(self.view_name, urlconf="gbe.urls")
     login_as(UserFactory(), self)
     response = self.client.get(url)
     nt.assert_equal(response.status_code, 302)
Ejemplo n.º 12
0
 def test_edit_act_user_has_no_profile(self):
     user = UserFactory()
     act = ActFactory()
     url = reverse(self.view_name, args=[act.pk], urlconf="gbe.urls")
     login_as(user, self)
     response = self.client.post(url,
                                 data=self.get_act_form(act, submit=True))
     self.assertEqual(response.status_code, 302)
Ejemplo n.º 13
0
 def test_edit_act_techinfo_no_profile(self):
     context = ActTechInfoContext()
     url = reverse('act_techinfo_edit',
                   urlconf='gbe.urls',
                   args=[context.act.pk])
     login_as(UserFactory(), self)
     response = self.client.get(url, follow=True)
     self.assertRedirects(response,
                          reverse("profile_update", urlconf="gbe.urls"))
Ejemplo n.º 14
0
 def test_create_troupe_no_performer(self):
     '''edit_troupe view, create flow
     '''
     login_as(UserFactory(), self)
     url = reverse(self.view_name, urlconf='gbe.urls')
     response = self.client.get(url)
     self.assertEqual(response.status_code, 302)
     expected_loc = 'http://testserver/update_profile?next=/troupe/create'
     self.assertEqual(location(response), expected_loc)
Ejemplo n.º 15
0
 def test_unfinished_user(self):
     unfinished = UserFactory()
     login_as(unfinished, self)
     response = self.client.get(self.url, follow=True)
     redirect_url = reverse('register',
                            urlconf='gbe.urls') + "?next=" + self.url
     self.assertRedirects(response, redirect_url)
     self.assertContains(response, "Create an Account")
     assert_alert_exists(response, 'warning', 'Warning', no_profile_msg)
Ejemplo n.º 16
0
 def test_edit_vendor_no_profile(self):
     vendor = VendorFactory()
     login_as(UserFactory(), self)
     url = reverse(self.view_name, urlconf='gbe.urls', args=[vendor.pk])
     response = self.client.get(url)
     self.assertEqual(302, response.status_code)
     self.assertEqual(
         location(response),
         'http://testserver/update_profile?next=/vendor/create')
Ejemplo n.º 17
0
 def test_no_profile(self):
     troupe = TroupeFactory()
     user = UserFactory()
     url = reverse("troupe_view",
                   args=[troupe.resourceitem_id],
                   urlconf='gbe.urls')
     login_as(user, self)
     response = self.client.get(url)
     nt.assert_equal(302, response.status_code)
Ejemplo n.º 18
0
 def test_edit_vendor_no_profile(self):
     vendor = VendorFactory()
     login_as(UserFactory(), self)
     url = reverse(self.view_name, urlconf='gbe.urls', args=[vendor.pk])
     response = self.client.get(url)
     self.assertEqual(302, response.status_code)
     self.assertRedirects(
         response,
         reverse('profile_update', urlconf='gbe.urls') +
         '?next=/vendor/create')
Ejemplo n.º 19
0
 def test_bid_no_profile(self):
     '''act_bid, when user has no profile, should bounce out to /profile'''
     url = reverse(self.view_name, urlconf='gbe.urls')
     user = UserFactory()
     login_as(user, self)
     response = self.client.get(url, )
     self.assertRedirects(
         response,
         '%s?next=%s' % (reverse('profile_update', urlconf='gbe.urls'),
                         reverse('class_create', urlconf='gbe.urls')))
 def test_list_profile_w_search_by_last_name(self):
     profile1 = ProfileFactory()
     profile2 = ProfileFactory(user_object=UserFactory(
         last_name="NOT HERE"))
     login_as(self.user, self)
     response = self.client.get("%s?q=%s" %
                                (self.url, profile1.user_object.last_name))
     self.assertContains(response, profile1.display_name)
     self.assertContains(response, profile1.pk)
     self.assertNotContains(response, profile2.display_name)
Ejemplo n.º 21
0
 def test_logged_in_no_profile(self):
     user = UserFactory()
     login_as(user, self)
     url = reverse('calendar',
                   urlconf="gbe.scheduling.urls",
                   args=['General'])
     data = {'day': "02-06-2016"}
     response = self.client.get(url, data=data)
     set_fav_link = reverse("set_favorite",
                            args=[self.showcontext.sched_event.pk, "on"],
                            urlconf="gbe.scheduling.urls")
     self.assertContains(response, "%s?next=%s" % (set_fav_link, url))
 def test_no_profile(self):
     troupe = TroupeFactory()
     url = reverse(self.view_name,
                   args=[troupe.pk],
                   urlconf='gbe.urls')
     login_as(UserFactory(), self)
     response = self.client.get(url, follow=True)
     expected_loc = '%s?next=%s' % (
         reverse('profile_update', urlconf="gbe.urls"),
         url)
     self.assertRedirects(response, expected_loc)
     self.assertContains(response, no_profile_msg)
Ejemplo n.º 23
0
 def test_edit_persona(self):
     '''edit_troupe view, create flow
     '''
     url = reverse(self.view_name,
                   urlconf="gbe.urls",
                   args=[self.persona.resourceitem_id])
     login_as(UserFactory(), self)
     response = self.client.get(url, follow=True)
     self.assertRedirects(response,
                          reverse("profile_update", urlconf="gbe.urls"))
     login_as(self.persona.performer_profile, self)
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     self.assertTrue(self.expected_string in response.content)
 def test_post_rehearsal_no_profile(self):
     context = ActTechInfoContext()
     extra_rehearsal = context._schedule_rehearsal(context.sched_event)
     extra_rehearsal.starttime = extra_rehearsal.starttime - timedelta(
         hours=1)
     extra_rehearsal.save()
     url = reverse(self.view_name,
                   urlconf='gbe.urls',
                   args=[context.act.pk])
     data = {'book': "Book Rehearsal"}
     data['%d-rehearsal' % context.sched_event.pk] = extra_rehearsal.pk
     login_as(UserFactory(), self)
     response = self.client.post(url, data, follow=True)
     self.assertRedirects(response,
                          reverse("profile_update", urlconf="gbe.urls"))
Ejemplo n.º 25
0
    def test_transactions_sync_eb_match_prior_purchaser(self, m_eventbrite):
        TicketingEvents.objects.all().delete()
        BrownPaperSettings.objects.all().delete()
        EventbriteSettings.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='******')
        purchaser = PurchaserFactory(matched_to_user=limbo)
        user = UserFactory(email=purchaser.email)
        m_eventbrite.return_value = order_dict

        login_as(self.privileged_user, self)
        response = self.client.post(self.url, data={'Sync': 'Sync'})
        print(response.content)
        test_purchaser = Purchaser.objects.get(pk=purchaser.pk)
        self.assertEqual(test_purchaser.matched_to_user, user)
Ejemplo n.º 26
0
 def test_post_update_upload_image(self):
     Image.objects.all().delete()
     UserFactory(username='******')
     image_style = StyleValueImageFactory(
         style_version=self.value.style_version,
         image=set_image(folder_name='Backgrounds'))
     file1 = open("tests/gbe/gbe_pagebanner.png", 'rb')
     login_as(self.user, self)
     data = self.get_post()
     data['update'] = 'Update'
     data['%s-style_property' % image_style.pk] = \
         image_style.style_property.pk
     data["%s-image" % image_style.pk] = image_style.image.pk
     data["%s-add_image" % image_style.pk] = file1
     response = self.client.post(self.url, data=data, follow=True)
     new_version = StyleVersion.objects.latest('pk')
     new_style_image = StyleValue.objects.get(
         style_version=new_version,
         style_property=image_style.style_property)
     self.assertContains(
         response,
         "Cloned %s from %s" % (new_version, self.value.style_version))
     self.assertRedirects(
         response,
         reverse("manage_theme",
                 urlconf="gbe.themes.urls",
                 args=[new_version.pk]))
     self.assertContains(response, image_style.style_property.selector)
     self.assertContains(response,
                         image_style.style_property.style_property)
     self.assertContains(
         response,
         '''<input type="radio" name="%s-image" value="%s"
         id="id_%s-image_1" checked>''' %
         (new_style_image.pk, image_style.image.pk + 1, new_style_image.pk),
         html=True)
Ejemplo n.º 27
0
 def test_no_profile(self):
     url = reverse('home', urlconf="gbe.urls")
     login_as(UserFactory(), self)
     response = self.client.get(url)
     nt.assert_true("Your Expo" in response.content)
Ejemplo n.º 28
0
 def test_edit_costume_no_profile(self):
     costume = CostumeFactory()
     url = reverse(self.view_name, args=[costume.pk], urlconf='gbe.urls')
     login_as(UserFactory(), self)
     response = self.client.get(url)
     self.assertEqual(response.status_code, 302)
 def test_update_profile_no_such_profile(self):
     user = UserFactory()
     url = reverse(self.view_name, urlconf='gbe.urls')
     login_as(user, self)
     response = self.client.get(url)
     self.assertTrue(user.profile is not None)
Ejemplo n.º 30
0
 def test_register_persona_no_profile(self):
     login_as(UserFactory(), self)
     url = reverse(self.view_name, urlconf='gbe.urls')
     response = self.client.get(url)
     self.assertEqual(response.status_code, 302)
 def test_review_vendor_no_profile(self):
     url = reverse('vendor_review', urlconf='gbe.urls')
     login_as(UserFactory(), self)
     response = self.client.get(url)
     nt.assert_equal(403, response.status_code)