def test_transactions_old_conf_limbo_purchase(self): limbo, created = User.objects.get_or_create(username='******') old_context = PurchasedTicketContext() old_context.conference.status = "past" old_context.conference.save() old_context.transaction.purchaser.matched_to_user = limbo old_context.transaction.purchaser.save() old_ticket = old_context.transaction.ticket_item old_ticket.ticketing_event.vendor_submission_event = True old_ticket.ticketing_event.save() context = PurchasedTicketContext() login_as(self.privileged_user, self) response = self.client.get( "%s?conference=%s" % (self.url, old_context.conference.conference_slug)) self.assertContains(response, old_context.transaction.purchaser.email) self.assertContains( response, "%s, %s" % (old_context.transaction.purchaser.last_name, old_context.transaction.purchaser.first_name)) self.assertContains( response, "%s - Vendor" % old_context.transaction.ticket_item.title) self.assertNotContains(response, "- Act") self.assertNotContains(response, context.transaction.purchaser.email) self.assertNotContains(response, context.profile.display_name) self.assertNotContains(response, context.transaction.ticket_item.title)
def test_env_stuff_w_inactive_purchaser(self): '''env_stuff view should load with no conf choice ''' Conference.objects.all().delete() inactive = ProfileFactory( display_name="DON'T SEE THIS", user_object__is_active=False ) ticket_context = PurchasedTicketContext(profile=inactive) transaction = ticket_context.transaction grant_privilege(self.profile, 'Registrar') login_as(self.profile, self) response = self.client.get( reverse('env_stuff', urlconf="gbe.reporting.urls")) self.assertEqual(response.status_code, 200) self.assertEqual(response.get('Content-Disposition'), "attachment; filename=env_stuff.csv") self.assertIn( "Badge Name,First,Last,Tickets,Ticket format,Personae," + "Staff Lead,Volunteering,Presenter,Show", response.content) self.assertNotIn( inactive.display_name, response.content)
def test_env_stuff_succeed(self): '''env_stuff view should load with no conf choice ''' ticket_context = PurchasedTicketContext() profile = ticket_context.profile transaction = ticket_context.transaction grant_privilege(profile, 'Registrar') login_as(profile, self) response = self.client.get( reverse('env_stuff', urlconf="gbe.reporting.urls")) self.assertEqual(response.status_code, 200) self.assertEqual(response.get('Content-Disposition'), "attachment; filename=env_stuff.csv") self.assertIn( "Badge Name,First,Last,Tickets,Ticket format,Personae," + "Staff Lead,Volunteering,Presenter,Show", response.content) self.assertIn( transaction.purchaser.matched_to_user.first_name, response.content) self.assertIn( transaction.ticket_item.title, response.content)
def test_export_badge_report_succeed_w_conf(self): '''get badges w a specific conference ''' ticket_context = PurchasedTicketContext() profile = ticket_context.profile transaction = ticket_context.transaction grant_privilege(profile, 'Registrar') login_as(profile, self) response = self.client.get(reverse( 'badge_report', urlconf='gbe.reporting.urls', args=[ transaction.ticket_item.bpt_event.conference.conference_slug])) self.assertEqual(response.status_code, 200) self.assertEqual(response.get('Content-Disposition'), "attachment; filename=print_badges.csv") self.assertIn( "First,Last,username,Badge Name,Badge Type,Date,State", response.content) self.assertIn( transaction.purchaser.matched_to_user.username, response.content) self.assertIn( transaction.ticket_item.title, response.content)
def test_transactions_w_privilege(self): context = PurchasedTicketContext() login_as(self.privileged_user, self) response = self.client.get(self.url) self.assertContains(response, context.transaction.purchaser.email) self.assertContains(response, context.profile.display_name) self.assertContains(response, context.transaction.ticket_item.title) self.assertNotContains(response, "- Vendor") self.assertNotContains(response, "- Act")
def setUp(self): self.client = Client() self.privileged_user = ProfileFactory.create().user_object grant_privilege(self.privileged_user, 'Registrar', 'view_transaction') self.url = reverse(self.view_name, urlconf='ticketing.urls') self.class_context = ClassContext() self.ticket_context = PurchasedTicketContext( profile=self.class_context.teacher.performer_profile, conference=self.class_context.conference)
def test_transactions_w_privilege_userview_editpriv(self): context = PurchasedTicketContext() context.transaction.ticket_item.ticketing_event.act_submission_event = True context.transaction.ticket_item.ticketing_event.save() grant_privilege(self.privileged_user, 'Registrar') login_as(self.privileged_user, self) response = self.client.get(self.url + "?format=user") self.assertContains(response, context.profile.user_object.email) self.assertContains(response, context.profile.display_name) self.assertContains(response, "%s - Act" % context.transaction.ticket_item.title) self.assertNotContains(response, "- Vendor") self.assertContains( response, reverse('admin_profile', urlconf="gbe.urls", args=[context.profile.resourceitem_id]))
def test_export_badge_report_inactive_user(self): '''loads with the default conference selection. ''' inactive = ProfileFactory( display_name="DON'T SEE THIS", user_object__is_active=False ) ticket_context = PurchasedTicketContext(profile=inactive) transaction = ticket_context.transaction grant_privilege(self.profile, 'Registrar') login_as(self.profile, self) response = self.client.get(reverse('badge_report', urlconf='gbe.reporting.urls')) self.assertEqual(response.status_code, 200) self.assertIn( transaction.purchaser.first_name, response.content) self.assertNotIn( inactive.display_name, response.content)
def test_env_stuff_succeed_w_conf(self): '''env_stuff view should load for a selected conference slug ''' ticket_context = PurchasedTicketContext() profile = ticket_context.profile grant_privilege(profile, 'Registrar') transaction = ticket_context.transaction login_as(profile, self) response = self.client.get( reverse('env_stuff', urlconf="gbe.reporting.urls", args=[ transaction.ticket_item.ticketing_event.conference. conference_slug ])) self.assertEqual(response.status_code, 200) self.assertEqual(response.get('Content-Disposition'), "attachment; filename=env_stuff.csv") self.assertContains( response, "Badge Name,First,Last,Tickets,Ticket format,Personae," + "Staff Lead,Volunteering,Presenter,Show") self.assertContains(response, transaction.purchaser.matched_to_user.first_name) self.assertContains(response, transaction.ticket_item.title)