def get_act_w_roles(self, act): ActCastingOptionFactory(casting="Regular Act", show_as_special=False, display_order=0) ActCastingOptionFactory(display_order=1) url = reverse('act_review', urlconf='gbe.urls', args=[act.pk]) login_as(self.privileged_user, self) return self.client.get(url)
def test_feature_performers(self): ActCastingOptionFactory(casting="Regular Act", show_as_special=False, display_order=0) ActCastingOptionFactory(display_order=1) context = ActTechInfoContext(act_role="Hosted By...") url = reverse(self.view_name, urlconf="gbe.scheduling.urls", args=[context.show.eventitem_id]) response = self.client.get(url) self.assertEqual(200, response.status_code) self.assertContains(response, context.performer.name) self.assertContains(response, "Hosted By...")
def test_act_bad_role(self): UserMessage.objects.all().delete() ActCastingOptionFactory() new_context = ActTechInfoContext() login_as(self.privileged_user, self) data = self.data data['casting'] = "I'm a bad role" response = self.client.post(self.url, data=self.data, follow=True) assert_alert_exists(response, 'danger', 'Error', no_casting_msg)
def test_empty_casting(self): ActCastingOptionFactory(display_order=1) context = ActTechInfoContext(act_role="") url = reverse(self.view_name, urlconf="gbe.scheduling.urls", args=[context.show.eventitem_id]) response = self.client.get(url) self.assertEqual(200, response.status_code) self.assertContains(response, context.performer.name) self.assertContains(response, "Fabulous Performers")
def test_feature_grid_for_admin(self): ActCastingOptionFactory(casting="Regular Act", show_as_special=False, display_order=0) ActCastingOptionFactory(display_order=1) context = ActTechInfoContext(act_role="Hosted By...") url = reverse(self.view_name, urlconf="gbe.scheduling.urls", args=[context.show.eventitem_id]) superuser = User.objects.create_superuser('test_feature_editor', '*****@*****.**', 'secret') ProfileFactory(user_object=superuser) set_image(context.performer) login_as(superuser, self) response = self.client.get(url) self.assertEqual(200, response.status_code) self.assertContains(response, "/admin/gbe/performer/%d" % context.performer.pk)
def setUp(self): self.regular_casting = ActCastingOptionFactory( casting="Regular Act", show_as_special=False, display_header="Check Out these Performers", display_order=0) Conference.objects.all().delete() self.client = Client() self.context = ActTechInfoContext() self.url = reverse(self.view_name, urlconf="gbe.scheduling.urls", args=[self.context.show.eventitem_id])
def test_act_no_role(self): UserMessage.objects.all().delete() ActCastingOptionFactory() new_context = ActTechInfoContext() url = reverse(self.view_name, args=[self.context.act.pk], urlconf='gbe.urls') login_as(self.privileged_user, self) data = self.data data.pop('casting', None) response = self.client.post(url, data=self.data, follow=True) assert_alert_exists(response, 'danger', 'Error', no_casting_msg)
def test_act_special_role(self): ActCastingOptionFactory() new_context = ActTechInfoContext() url = reverse(self.view_name, args=[self.context.act.pk], urlconf='gbe.urls') login_as(self.privileged_user, self) data = self.data data['casting'] = "Hosted by..." response = self.client.post(url, data=self.data, follow=True) casting = ActResource.objects.get(_item=self.context.act) assert (casting.role == data['casting']) self.assertRedirects(response, reverse('act_review_list', urlconf='gbe.urls'))
def test_act_change_to_special_role(self): # accepted -> accepted # change show, change role ActCastingOptionFactory() new_context = ActTechInfoContext() login_as(self.privileged_user, self) data = self.data data['casting'] = "Hosted by..." data['accepted'] = 3 response = self.client.post(self.url, data=data, follow=True) casting = Ordering.objects.get(class_id=self.context.act.pk) assert (casting.role == data['casting']) self.assertRedirects(response, reverse('act_review_list', urlconf='gbe.urls'))
def test_act_bad_role(self): UserMessage.objects.all().delete() ActCastingOptionFactory() new_context = ActTechInfoContext() url = reverse(self.view_name, args=[self.context.act.pk], urlconf='gbe.urls') login_as(self.privileged_user, self) data = self.data data['casting'] = "I'm a bad role" response = self.client.post(url, data=self.data, follow=True) with self.assertRaises(ActResource.DoesNotExist): ActResource.objects.get(_item=self.context.act) assert_alert_exists(response, 'danger', 'Error', no_casting_msg)
def test_feature_grid_for_admin_w_image(self): ActCastingOptionFactory(display_order=1) context = ActTechInfoContext(act_role="Hosted by...") set_image(context.performer) url = reverse(self.view_name, urlconf="gbe.scheduling.urls", args=[context.show.eventitem_id]) superuser = User.objects.create_superuser('test_feature_img_editor', '*****@*****.**', 'secret') ProfileFactory(user_object=superuser) login_as(superuser, self) response = self.client.get(url) self.assertEqual(200, response.status_code) self.assertContains( response, "/admin/filer/image/%d/?_pick=file&_popup=1" % (context.performer.img.pk))
def test_act_accept_and_special_role(self): # accepted -> accepted # change show, change role ActCastingOptionFactory() act = ActFactory(b_conference=self.context.conference) url = reverse(self.view_name, args=[act.pk], urlconf='gbe.urls') login_as(self.privileged_user, self) data = self.data data['casting'] = "Hosted by..." data['accepted'] = 3 response = self.client.post(url, data=data, follow=True) casting = Ordering.objects.get(class_id=act.pk) assert (casting.role == data['casting']) self.assertRedirects(response, reverse('act_review_list', urlconf='gbe.urls')) assert_email_template_create( 'act accepted - %s' % self.show.e_title.lower(), "Your act has been cast in %s" % self.show.e_title)
def setUp(self): self.client = Client() self.context = ActTechInfoContext() self.show = ShowFactory(e_conference=self.context.conference) self.sched_event = SchedEventFactory(eventitem=self.show.eventitem_ptr) EventLabelFactory(event=self.sched_event, text=self.context.conference.conference_slug) self.privileged_user = ProfileFactory().user_object grant_privilege(self.privileged_user, 'Act Coordinator') grant_privilege(self.privileged_user, 'Act Reviewers') self.data = { 'show': self.show.eventitem_id, 'casting': 'Regular Act', 'accepted': '2' } self.url = reverse(self.view_name, args=[self.context.act.pk], urlconf='gbe.urls') self.regular_casting = ActCastingOptionFactory( casting="Regular Act", show_as_special=False, display_header="Check Out these Performers", display_order=1)
def test_act_change_role_keep_rehearsal(self): # accepted -> accepted # same show, change role, keep rehearsal rehearsal_event = self.context._schedule_rehearsal( self.context.sched_event, act=self.context.act) ActCastingOptionFactory() login_as(self.privileged_user, self) data = { 'casting': "Hosted by...", 'accepted': 3, 'show': self.context.show.eventitem_id, } response = self.client.post(self.url, data=data, follow=True) casting = Ordering.objects.get(class_id=self.context.act.pk, role="Hosted by...") assert (casting.role == data['casting']) self.assertRedirects(response, reverse('act_review_list', urlconf='gbe.urls')) self.assertEqual( ResourceAllocation.objects.filter(event=rehearsal_event).count(), 1) self.assertEqual( ResourceAllocation.objects.filter( event=self.context.sched_event).count(), 2)