def test_review_act_techinfo_complete_w_no_rehearsal(self): '''review_act_techinfo view should load for Tech Crew and fail for others ''' self.context = ActTechInfoContext() self.context.act.tech = TechInfoFactory( confirm_no_music=True, confirm_no_rehearsal=True, prop_setup="[u'I have props I will need ' + \ 'set before my number', u'I will leave props or set pieces ' + \ 'on-stage that will need to be cleared']", starting_position="Onstage", primary_color="text", feel_of_act="text", pronouns="text", introduction_text="text") self.context.act.accepted = 3 self.context.act.save() login_as(self.profile, self) response = self.client.get( reverse(self.view_name, urlconf='gbe.reporting.urls', args=[self.context.act.id])) self.assertContains(response, self.context.act.b_title) self.assertNotContains(response, "Act Tech is NOT complete") self.assertContains(response, "Not Attending")
def test_two_acts_one_show(self): '''Basic test of landing_page view ''' url = reverse('home', urlconf='gbe.urls') login_as(self.profile, self) # Bid types previous and current current_act_context = ActTechInfoContext( performer=self.performer, act=self.current_act, conference=self.current_conf) second_act_context = ActTechInfoContext( performer=self.performer, conference=self.current_conf, show=current_act_context.show, sched_event=current_act_context.sched_event) self.current_act.accepted = 3 self.current_act.save() response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertContains(response, second_act_context.act.b_title, count=3) self.assertContains(response, current_act_context.act.b_title, count=3) self.assertContains(response, second_act_context.show.e_title, count=2)
def test_complete_wout_rehearsals_act(self): ''' view should load ''' complete_act_context = ActTechInfoContext() complete_act_context.act.tech = TechInfoFactory( confirm_no_music=True, confirm_no_rehearsal=True, prop_setup="text", starting_position="Onstage", primary_color="text", feel_of_act="text", pronouns="text", introduction_text="text") complete_act_context.act.accepted = 3 complete_act_context.act.save() self.profile = complete_act_context.make_priv_role() login_as(self.profile, self) response = self.client.get( reverse(self.view_name, urlconf='gbe.scheduling.urls', args=[complete_act_context.sched_event.pk])) self.assertContains(response, complete_act_context.act.b_title) self.assertNotContains(response, 'class="gbe-table-row gbe-table-danger"') self.assertContains(response, "No audio track needed") self.assertContains(response, "Acknowledged No Rehearsal") self.assertContains( response, '<i class="fas fa-check-circle gbe-text-success"></i>')
def test_edit_act_techinfo_post_two_shows_same_title(self): context = ActTechInfoContext(schedule_rehearsal=True) context.show.cue_sheet = "Alternate" context.show.save() context.rehearsal.max_volunteer = 1 context.rehearsal.save() another_rehearsal = context._schedule_rehearsal(context.sched_event) ShowFactory(e_title=context.show.e_title) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) data = self.get_full_post( another_rehearsal, context.show).copy() data.update(self.get_cues(context.act.tech, 3, False)) response = self.client.post( url, data=data) self.assertRedirects(response, reverse('home', urlconf='gbe.urls')) self.assertEqual(len(context.act.get_scheduled_rehearsals()), 1) self.assertEqual(context.act.get_scheduled_rehearsals()[0], another_rehearsal)
def test_stage_manager_button(self): self.context = ActTechInfoContext(schedule_rehearsal=True) self.profile = self.context.make_priv_role() response = self.get_landing_page() self.assertContains(response, reverse( 'show_dashboard', urlconf='gbe.scheduling.urls', args=[self.context.sched_event.pk]))
def setUp(self): self.context = ActTechInfoContext(schedule_rehearsal=True) self.client = Client() self.profile = ProfileFactory() grant_privilege(self.profile, 'Tech Crew') self.url = reverse(self.view_name, urlconf='gbe.reporting.urls', args=[self.context.act.id])
def setUp(self): self.client = Client() self.context = ActTechInfoContext(schedule_rehearsal=True) self.other_context = ActTechInfoContext( conference=self.context.conference) self.profile = self.context.make_priv_role() self.url = reverse(self.view_name, urlconf='gbe.scheduling.urls', args=[self.context.sched_event.pk])
def post_act_tech_info_success(self, num_cues=3): context = ActTechInfoContext(schedule_rehearsal=True) another_rehearsal = context._schedule_rehearsal(context.sched_event) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) data = self.get_full_post(another_rehearsal, context.show).copy() data.update(self.get_cues(context.act.tech, num_cues)) response = self.client.post(url, data=data, follow=True) return response, context, another_rehearsal
def test_edit_act_techinfo_form_invalid(self): context = ActTechInfoContext(schedule_rehearsal=True) another_rehearsal = context._schedule_rehearsal(context.sched_event) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) data = self.get_full_post(another_rehearsal, context.show).copy() data.update(self.get_cues(context.act.tech, 1)) data['stage_info-act_duration'] = 'bad no duration' response = self.client.post(url, data=data, follow=True) self.assertContains(response, 'Please enter your duration as mm:ss')
def test_act_changestate_stay_waitlisted_act(self): # waitlisted -> waitlisted # change show self.context = ActTechInfoContext(set_waitlist=True) self.url = reverse(self.view_name, args=[self.context.act.pk], urlconf='gbe.urls') login_as(self.privileged_user, self) response = self.client.post(self.url, data=self.data) casting = Ordering.objects.get(class_id=self.context.act.pk, allocation__event=self.sched_event) assert (casting.role == "Waitlisted")
def test_edit_act_techinfo_authorized_user_cues_not_set(self): context = ActTechInfoContext(schedule_rehearsal=False) another_rehearsal = context._schedule_rehearsal(context.sched_event) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) response = self.client.post(url, data=self.get_full_post( another_rehearsal, context.show)) self.assertEqual(response.status_code, 200) self.assertContains( response, 'Add text if you wish to save information for this cue.')
def test_bad_casting(self): ActCastingOptionFactory(display_order=1) context = ActTechInfoContext(act_role="Weirdo") another_context = ActTechInfoContext(act_role="Weirdo", sched_event=context.sched_event, conference=context.conference) 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, another_context.performer.name) self.assertContains(response, "Fabulous Performers")
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"))
def test_edit_act_techinfo_rehearsal_ready(self): context = ActTechInfoContext() rehearsal = context._schedule_rehearsal(context.sched_event) url = reverse(self.view_name, urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) response = self.client.get(url) self.assertContains(response, "Set Rehearsal Time") assert_option_state(response, str(rehearsal.id), date_format(rehearsal.starttime, "TIME_FORMAT"), True) self.assertNotContains(response, "Provide Technical Information") self.assertNotContains(response, 'Advanced Technical Information (Optional)')
def test_post_bad_advanced(self): context = ActTechInfoContext(schedule_rehearsal=True) context.act.tech.confirm_no_music = True context.act.tech.mic_choice = mic_options[2] context.act.tech.prop_setup = "[u'I have props I will need set " + \ "before my number']" context.act.tech.feel_of_act = "feel" context.act.tech.starting_position = "Onstage" context.act.tech.primary_color = "Red" context.act.tech.pronouns = "Me/Myself" context.act.tech.duration = timedelta(minutes=2) context.act.tech.introduction_text = "Yo this is an intro" data = { 'mic_choice': "These are bad", 'follow_spot_color': 'red', 'background_color': 'blue', 'wash_color': 'purple', 'special_lighting_cue': 'when I drop my pants, make it pink', 'start_blackout': True, 'end_blackout': True, } url = reverse(self.view_name, urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) response = self.client.post(url, data, follow=True) self.assertEqual(response.status_code, 200) self.assertContains(response, 'Select a valid choice.') self.assertContains(response, "Advanced Technical Information (Optional)")
def test_edit_act_techinfo_get_bad_act(self): context = ActTechInfoContext() bad_act_id = Act.objects.aggregate(Max('pk'))['pk__max'] + 1 url = reverse(self.view_name, urlconf='gbe.urls', args=[bad_act_id]) login_as(context.performer.contact, self) response = self.client.get(url, follow=True) self.assertEqual(404, response.status_code)
def test_review_special_role_already_cast(self): context = ActTechInfoContext(act_role="Hosted by...") response = self.get_act_w_roles(context.act) self.assertEqual(response.status_code, 200) self.assertContains( response, '<option value="Hosted by..." selected="selected"' + '>Hosted by...</option>')
def test_post_good_advanced(self): context = ActTechInfoContext(schedule_rehearsal=True) context.act.tech.confirm_no_music = True context.act.tech.mic_choice = mic_options[2] context.act.tech.prop_setup = "[u'I have props I will need set " + \ "before my number']" context.act.tech.feel_of_act = "feel" context.act.tech.starting_position = "Onstage" context.act.tech.primary_color = "Red" context.act.tech.pronouns = "Me/Myself" context.act.tech.duration = timedelta(minutes=2) context.act.tech.introduction_text = "Yo this is an intro" data = { 'mic_choice': mic_options[2], 'follow_spot_color': 'red', 'background_color': 'blue', 'wash_color': 'purple', 'special_lighting_cue': 'when I drop my pants, make it pink', 'start_blackout': True, 'end_blackout': True, } url = reverse(self.view_name, urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) response = self.client.post(url, data, follow=True) self.assertRedirects(response, reverse('home', urlconf='gbe.urls')) assert_alert_exists(response, 'success', 'Success', default_act_tech_advanced_submit)
def test_act_accept_makes_template_per_show(self): # waitlisted -> accepted # change show, same role self.context = ActTechInfoContext(set_waitlist=True) self.url = reverse(self.view_name, args=[self.context.act.pk], urlconf='gbe.urls') login_as(self.privileged_user, self) self.data['accepted'] = '3' response = self.client.post(self.url, data=self.data) assert_email_template_create( 'act accepted - %s' % self.show.e_title.lower(), "Your act has been cast in %s" % self.show.e_title) casting = Ordering.objects.get(class_id=self.context.act.pk, allocation__event=self.sched_event) assert (casting.role == "Regular Act")
def post_act_tech_info_success(self, num_cues=3): context = ActTechInfoContext(schedule_rehearsal=True) another_rehearsal = context._schedule_rehearsal(context.sched_event) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) data = self.get_full_post( another_rehearsal, context.show).copy() data.update(self.get_cues(context.act.tech, num_cues)) response = self.client.post( url, data=data, follow=True) return response, context, another_rehearsal
def test_no_act_tech_alert(self): current_act_context = ActTechInfoContext( performer=self.performer, act=self.current_act, conference=self.current_conf, schedule_rehearsal=True) self.current_act.tech = TechInfoFactory( track_artist="", track=SimpleUploadedFile("file.mp3", b"file_content"), prop_setup="text", starting_position="Onstage", primary_color="text", feel_of_act="text", pronouns="text", introduction_text="text") self.current_act.accepted = 3 self.current_act.save() event_id = make_act_app_ticket(self.current_conf) response = self.get_landing_page() self.assertNotContains( response, SCHEDULE_REHEARSAL % ( self.current_act.b_title, reverse('act_tech_wizard', urlconf='gbe.urls', args=[self.current_act.id])))
def test_edit_act_techinfo_authorized_user_cues_not_set(self): context = ActTechInfoContext(schedule_rehearsal=False) another_rehearsal = context._schedule_rehearsal(context.sched_event) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) response = self.client.post( url, data=self.get_full_post( another_rehearsal, context.show)) self.assertEqual(response.status_code, 200) self.assertContains( response, 'Add text if you wish to save information for this cue.')
def test_send_for_show(self): start_time = datetime.combine( datetime.now().date() + timedelta(days=1), time(0, 0, 0, 0)) show_context = ShowContext(starttime=start_time) context = ActTechInfoContext(show=show_context.show, sched_event=show_context.sched_event, schedule_rehearsal=True) num = schedule_email() self.assertEqual(2, num) queued_email = Email.objects.filter( status=2, subject=self.subject, from_email=settings.DEFAULT_FROM_EMAIL, ) self.assertEqual(queued_email.count(), 2) first = queued_email.filter( to=show_context.performer.performer_profile.user_object.email)[0] self.assertTrue(show_context.show.e_title in first.html_message) self.assertTrue(self.unsub_link in queued_email[0].html_message) self.assertTrue(self.get_param in queued_email[0].html_message) second = queued_email.filter( to=context.performer.performer_profile.user_object.email)[0] self.assertTrue(context.show.e_title in second.html_message) self.assertTrue( context.rehearsal.eventitem.event.e_title in second.html_message)
def test_edit_act_techinfo_authorized_user_with_rehearsal(self): context = ActTechInfoContext(schedule_rehearsal=True) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertTrue("Cue Sheet Instructions" in response.content) self.assertContains( response, '<tr class="bid-table">\n' + ' <th class="bid-table">Cue #</th>\n' + ' <th class="bid-table">Cue Off of...</th>\n' + ' <th class="bid-table">Follow spot</th>\n' + ' <th class="bid-table">Backlight</th>\n' + ' <th class="bid-table">Center Spot</th>\n' + ' <th class="bid-table">Cyc Light</th>\n' + ' <th class="bid-table">Wash</th>\n' + ' <th class="bid-table">Sound</th>\n' + ' </tr>') self.assertContains( response, '<option value="' + str(context.rehearsal.id) + '" selected="selected">' + "%s: %s" % (context.rehearsal.as_subtype.e_title, date_format(context.rehearsal.starttime, "TIME_FORMAT")) + '</option>')
def test_act_tech_troupe_member_view(self): troupe = TroupeFactory() member = PersonaFactory() troupe.membership.add(member) act = ActFactory(performer=troupe, submitted=True, b_conference=self.current_conf, accepted=3) current_act_context = ActTechInfoContext( performer=troupe, act=act, conference=self.current_conf, schedule_rehearsal=True) act.tech = TechInfoFactory( track_artist="", track=SimpleUploadedFile("file.mp3", b"file_content"), prop_setup="text", starting_position="Onstage", primary_color="text", feel_of_act="text", pronouns="text", introduction_text="text") act.tech.save() event_id = make_act_app_ticket(self.current_conf) login_as(member.performer_profile, self) url = reverse("home", urlconf="gbe.urls") response = self.client.get(url) self.assertContains( response, reverse("act_techinfo_detail", urlconf="gbe.reporting.urls", args=[act.pk]))
def setUp(self): 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_book_bad_rehearsal(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]) login_as(context.performer.contact, self) data = {'book': "Book Rehearsal"} data['%d-rehearsal' % context.sched_event.pk] = extra_rehearsal.pk + 5 response = self.client.post(url, data, follow=True) self.assertNotContains(response, default_rehearsal_booked) self.assertContains(response, "Select a valid choice.") self.assertContains(response, "Set Rehearsal Time") self.assertNotContains(response, "Provide Technical Information")
def test_edit_act_techinfo_authorized_user_rehearsal_not_set(self): context = ActTechInfoContext(schedule_rehearsal=False) another_rehearsal = context._schedule_rehearsal(context.sched_event) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) data = self.get_full_post(another_rehearsal, context.show).copy() data.update(self.get_cues(context.act.tech, 3)) response = self.client.post(url, data=data) self.assertRedirects(response, reverse('home', urlconf='gbe.urls')) self.assertEqual(len(context.act.get_scheduled_rehearsals()), 1) self.assertEqual(context.act.get_scheduled_rehearsals()[0], another_rehearsal) self.assertEqual( context.act.tech.cueinfo_set.get(cue_sequence=2).cyc_color, 'White')
def test_edit_act_techinfo_wrong_profile(self): context = ActTechInfoContext() url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(ProfileFactory(), self) response = self.client.get(url) self.assertTrue(400 <= response.status_code < 500)
def test_view_techinfo_with_conference_slug(self): '''review_act_techinfo view show correct events for slug ''' context = ActTechInfoContext() login_as(self.privileged_user, self) args = {'conf_slug': context.conference.conference_slug} response = self.client.get(self.url, args) self.assertEqual(response.status_code, 200) nt.assert_true(context.show.e_title in response.content)
def test_edit_act_techinfo_post_complete_alt_cues_full_rehearsal(self): context = ActTechInfoContext(schedule_rehearsal=True) context.show.cue_sheet = "Alternate" context.show.save() context.rehearsal.max_volunteer = 1 context.rehearsal.save() another_rehearsal = context._schedule_rehearsal(context.sched_event) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) data = self.get_full_post(another_rehearsal, context.show).copy() data.update(self.get_cues(context.act.tech, 3, False)) data['audio_info-track_duration'] = 3.3 response = self.client.post(url, data=data) self.assertEqual(response.status_code, 200) self.assertContains(response, "Please enter your duration as mm:ss")
def test_edit_act_techinfo_authorized_user_post_empty_form(self): context = ActTechInfoContext(schedule_rehearsal=True) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) response = self.client.post(url, {}) self.assertEqual(response.status_code, 200) self.assertTrue("Cue Sheet Instructions" in response.content)
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"))
def test_edit_act_techinfo_form_invalid(self): context = ActTechInfoContext(schedule_rehearsal=True) another_rehearsal = context._schedule_rehearsal(context.sched_event) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) data = self.get_full_post( another_rehearsal, context.show).copy() data.update(self.get_cues(context.act.tech, 1)) data['stage_info-act_duration'] = 'bad no duration' response = self.client.post( url, data=data, follow=True) self.assertContains( response, 'Please enter your duration as mm:ss')
def test_edit_act_techinfo_authorized_user_rehearsal_not_set(self): context = ActTechInfoContext(schedule_rehearsal=False) another_rehearsal = context._schedule_rehearsal(context.sched_event) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) data = self.get_full_post( another_rehearsal, context.show).copy() data.update(self.get_cues(context.act.tech, 3)) response = self.client.post( url, data=data) self.assertRedirects(response, reverse('home', urlconf='gbe.urls')) self.assertEqual(len(context.act.get_scheduled_rehearsals()), 1) self.assertEqual(context.act.get_scheduled_rehearsals()[0], another_rehearsal) self.assertEqual( context.act.tech.cueinfo_set.get( cue_sequence=2).cyc_color, 'White')
def test_edit_act_techinfo_post_complete_alt_cues_full_rehearsal(self): context = ActTechInfoContext(schedule_rehearsal=True) context.show.cue_sheet = "Alternate" context.show.save() context.rehearsal.max_volunteer = 1 context.rehearsal.save() another_rehearsal = context._schedule_rehearsal(context.sched_event) url = reverse('act_techinfo_edit', urlconf='gbe.urls', args=[context.act.pk]) login_as(context.performer.contact, self) data = self.get_full_post( another_rehearsal, context.show).copy() data.update(self.get_cues(context.act.tech, 3, False)) data['audio_info-track_duration'] = 3.3 response = self.client.post( url, data=data) self.assertEqual(response.status_code, 200) self.assertContains(response, "Please enter your duration as mm:ss")