def test_full_login_first_get(self): n = 0 login_as(self.privileged_profile, self) response = self.client.get(self.url, follow=True) assert_checkbox( response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) for priv in self.priv_list: assert_checkbox( response, "bid_type", n, priv, priv) n = n + 1 for state in acceptance_states: self.assertContains( response, 'value="%s"' % state[0]) self.assertContains( response, state[1]) self.assertContains(response, "Email Everyone")
def test_pick_drop_in(self): special = GenericEventFactory(e_conference=self.context.conference, type="Drop-In") specialstaffcontext = VolunteerContext(event=special, role="Teacher") limited_profile = ProfileFactory() grant_privilege(limited_profile.user_object, "Registrar") login_as(limited_profile, self) data = { 'email-select-conference': [ self.context.conference.pk, ], 'email-select-roles': [ 'Teacher', ], 'event-select-event_collections': "Drop-In", 'refine': True, } response = self.client.post(self.url, data=data, follow=True) print response self.assertNotContains(response, self.context.teacher.contact.user_object.email) self.assertContains(response, specialstaffcontext.profile.user_object.email) self.assertNotContains(response, special.e_title) assert_checkbox(response, "event_collections", 1, "Drop-In", "All Drop-In Classes", prefix="event-select")
def test_pick_drop_in(self): special = GenericEventFactory( e_conference=self.context.conference, type="Drop-In") specialstaffcontext = VolunteerContext( event=special, role="Teacher" ) limited_profile = ProfileFactory() grant_privilege(limited_profile.user_object, "Registrar") login_as(limited_profile, self) data = { 'email-select-conference': [self.context.conference.pk, ], 'email-select-roles': ['Teacher', ], 'event-select-event_collections': "Drop-In", 'refine': True, } response = self.client.post(self.url, data=data, follow=True) print response self.assertNotContains( response, self.context.teacher.contact.user_object.email) self.assertContains( response, specialstaffcontext.profile.user_object.email) self.assertNotContains( response, special.e_title) assert_checkbox( response, "event_collections", 1, "Drop-In", "All Drop-In Classes", prefix="event-select")
def test_pick_performer_specific_show(self): showcontext = ShowContext() anothershowcontext = ShowContext(conference=showcontext.conference, ) producer = showcontext.set_producer() login_as(producer, self) data = { 'email-select-conference': [showcontext.conference.pk, self.context.conference.pk], 'email-select-roles': [ 'Performer', ], 'event-select-events': showcontext.show.pk, 'refine': True, } response = self.client.post(self.url, data=data, follow=True) self.assertNotContains( response, anothershowcontext.performer.contact.user_object.email) self.assertContains(response, showcontext.performer.contact.user_object.email) assert_checkbox(response, "events", 0, showcontext.show.pk, showcontext.show.e_title, prefix="event-select") assert_checkbox(response, "events", 1, anothershowcontext.show.pk, anothershowcontext.show.e_title, checked=False, prefix="event-select")
def test_full_login_first_get_2_conf(self): extra_conf = ConferenceFactory() login_as(self.privileged_profile, self) response = self.client.get(self.url, follow=True) assert_checkbox(response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) assert_checkbox(response, "conference", 1, extra_conf.pk, extra_conf.conference_slug)
def test_reduced_login_first_get(self): self.reduced_login() response = self.client.get(self.url, follow=True) assert_checkbox(response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) assert_checkbox(response, "bid_type", 0, "Act", "Act") self.assertNotContains(response, "Class") self.assertNotContains(response, "Email Everyone")
def test_full_login_first_get(self): login_as(self.privileged_profile, self) response = self.client.get(self.url, follow=True) assert_checkbox(response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) n = 0 for role in role_options: assert_checkbox(response, "roles", n, role[0], role[1]) n = n + 1 self.assertContains(response, "Email Everyone")
def test_send_email_failure_preserve_bid_type_choice(self): login_as(self.privileged_profile, self) data = { 'sender': "*****@*****.**", 'html_message': "<p>Test Message</p>", 'email-select-conference': [self.context.conference.pk], 'email-select-bid_type': "Class", 'email-select-state': [0, 1, 2, 3, 4, 5], 'send': True } response = self.client.post(self.url, data=data, follow=True) assert_checkbox(response, "bid_type", 1, "Class", "Class")
def test_full_login_first_get(self): n = 0 login_as(self.privileged_profile, self) response = self.client.get(self.url, follow=True) assert_checkbox(response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) for priv in self.priv_list: assert_checkbox(response, "bid_type", n, priv, priv) n = n + 1 for state in acceptance_states: self.assertContains(response, 'value="%s"' % state[0]) self.assertContains(response, state[1]) self.assertContains(response, "Email Everyone")
def test_send_email_failure_preserve_choices(self): staffcontext = StaffAreaContext(conference=self.context.conference) volunteer, booking = staffcontext.book_volunteer() showcontext = ShowContext(conference=self.context.conference) showcontext.set_producer(producer=staffcontext.staff_lead) login_as(self.privileged_profile, self) data = { 'to': volunteer.user_object.email, 'sender': "*****@*****.**", 'html_message': "<p>Test Message</p>", 'email-select-conference': [self.context.conference.pk], 'email-select-roles': [ "Interested", ], 'event-select-events': showcontext.show.pk, 'event-select-staff_areas': staffcontext.area.pk, 'event-select-event_collections': "Volunteer", 'send': True } response = self.client.post(self.url, data=data, follow=True) assert_checkbox(response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) assert_checkbox(response, "roles", 0, "Interested", "Interested") assert_checkbox(response, "events", 0, showcontext.show.pk, showcontext.show.e_title, prefix="event-select") assert_checkbox(response, "event_collections", 2, "Volunteer", "All Volunteer Events", prefix="event-select")
def test_reduced_login_first_get(self): for priv, roles in role_option_privs.iteritems(): limited_profile = ProfileFactory() grant_privilege(limited_profile.user_object, priv) login_as(limited_profile, self) response = self.client.get(self.url, follow=True) assert_checkbox(response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) n = 0 for role in sorted(roles): assert_checkbox(response, "roles", n, role, role) n = n + 1 self.assertNotContains(response, "Email Everyone")
def test_full_login_first_get_2_conf(self): extra_conf = ConferenceFactory() login_as(self.privileged_profile, self) response = self.client.get(self.url, follow=True) assert_checkbox( response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) assert_checkbox( response, "conference", 1, extra_conf.pk, extra_conf.conference_slug)
def test_send_email_failure_preserve_bid_type_choice(self): login_as(self.privileged_profile, self) data = { 'sender': "*****@*****.**", 'html_message': "<p>Test Message</p>", 'email-select-conference': [self.context.conference.pk], 'email-select-bid_type': "Class", 'email-select-state': [0, 1, 2, 3, 4, 5], 'send': True } response = self.client.post(self.url, data=data, follow=True) assert_checkbox( response, "bid_type", 1, "Class", "Class")
def test_pick_all_conf_class(self): interested = self.context.set_interest() self.class_coord_login() data = { 'email-select-conference': [self.context.conference.pk], 'email-select-roles': ["Teacher"], 'event-select-event_collections': "Conference", 'refine': True, } response = self.client.post(self.url, data=data, follow=True) self.assertContains(response, self.context.teacher.contact.user_object.email) self.assertNotContains(response, interested.user_object.email) assert_checkbox(response, "event_collections", 0, "Conference", "All Conference Classes", prefix="event-select")
def test_full_login_first_get(self): login_as(self.privileged_profile, self) response = self.client.get(self.url, follow=True) assert_checkbox( response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) n = 0 for role in role_options: assert_checkbox( response, "roles", n, role[0], role[1]) n = n + 1 self.assertContains(response, "Email Everyone")
def test_reduced_login_first_get(self): self.reduced_login() response = self.client.get(self.url, follow=True) assert_checkbox( response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) assert_checkbox( response, "bid_type", 0, "Act", "Act") self.assertNotContains( response, "Class") self.assertNotContains(response, "Email Everyone")
def test_pick_performer_reduced_priv(self): showcontext = ShowContext() producer = showcontext.set_producer() anothershowcontext = ShowContext( conference=showcontext.conference, ) login_as(producer, self) data = { 'email-select-conference': [showcontext.conference.pk, self.context.conference.pk], 'email-select-roles': ['Performer', ], 'filter': True, } response = self.client.post(self.url, data=data, follow=True) self.assertNotContains( response, self.context.teacher.contact.user_object.email) self.assertContains( response, showcontext.performer.contact.user_object.email) self.assertContains( response, anothershowcontext.performer.contact.user_object.email) assert_checkbox( response, "events", 0, showcontext.show.pk, showcontext.show.e_title, checked=False, prefix="event-select") assert_checkbox( response, "events", 1, anothershowcontext.show.pk, anothershowcontext.show.e_title, checked=False, prefix="event-select")
def test_pick_all_conf_class(self): interested = self.context.set_interest() self.class_coord_login() data = { 'email-select-conference': [self.context.conference.pk], 'email-select-roles': ["Teacher"], 'event-select-event_collections': "Conference", 'refine': True, } response = self.client.post(self.url, data=data, follow=True) self.assertContains( response, self.context.teacher.contact.user_object.email) self.assertNotContains( response, interested.user_object.email) assert_checkbox( response, "event_collections", 0, "Conference", "All Conference Classes", prefix="event-select")
def test_reduced_login_first_get(self): for priv, roles in role_option_privs.iteritems(): limited_profile = ProfileFactory() grant_privilege(limited_profile.user_object, priv) login_as(limited_profile, self) response = self.client.get(self.url, follow=True) assert_checkbox( response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) n = 0 for role in sorted(roles): assert_checkbox( response, "roles", n, role, role) n = n + 1 self.assertNotContains(response, "Email Everyone")
def test_send_email_failure_preserve_choices(self): staffcontext = StaffAreaContext(conference=self.context.conference) volunteer, booking = staffcontext.book_volunteer() showcontext = ShowContext(conference=self.context.conference) showcontext.set_producer(producer=staffcontext.staff_lead) login_as(self.privileged_profile, self) data = { 'to': volunteer.user_object.email, 'sender': "*****@*****.**", 'html_message': "<p>Test Message</p>", 'email-select-conference': [self.context.conference.pk], 'email-select-roles': ["Interested", ], 'event-select-events': showcontext.show.pk, 'event-select-staff_areas': staffcontext.area.pk, 'event-select-event_collections': "Volunteer", 'send': True } response = self.client.post(self.url, data=data, follow=True) assert_checkbox( response, "conference", 0, self.context.conference.pk, self.context.conference.conference_slug) assert_checkbox( response, "roles", 0, "Interested", "Interested") assert_checkbox( response, "events", 0, showcontext.show.pk, showcontext.show.e_title, prefix="event-select") assert_checkbox( response, "event_collections", 2, "Volunteer", "All Volunteer Events", prefix="event-select")
def test_pick_all_vol_reduced_priv(self): staffcontext = StaffAreaContext() volunteer, booking = staffcontext.book_volunteer() special = GenericEventFactory( e_conference=staffcontext.conference) specialstaffcontext = VolunteerContext( event=special, ) login_as(staffcontext.staff_lead, self) data = { 'email-select-conference': [staffcontext.conference.pk, ], 'email-select-roles': ['Volunteer', ], 'event-select-event_collections': "Volunteer", 'refine': True, } response = self.client.post(self.url, data=data, follow=True) self.assertNotContains( response, self.context.teacher.contact.user_object.email) self.assertContains( response, volunteer.user_object.email) self.assertContains( response, specialstaffcontext.profile.user_object.email) assert_checkbox( response, "events", 0, special.pk, special.e_title, checked=False, prefix="event-select") assert_checkbox( response, "staff_areas", 0, staffcontext.area.pk, staffcontext.area.title, checked=False, prefix="event-select") assert_checkbox( response, "event_collections", 0, "Volunteer", "All Volunteer Events", prefix="event-select")
def test_pick_all_vol_reduced_priv(self): staffcontext = StaffAreaContext() volunteer, booking = staffcontext.book_volunteer() special = GenericEventFactory(e_conference=staffcontext.conference) specialstaffcontext = VolunteerContext(event=special, ) login_as(staffcontext.staff_lead, self) data = { 'email-select-conference': [ staffcontext.conference.pk, ], 'email-select-roles': [ 'Volunteer', ], 'event-select-event_collections': "Volunteer", 'refine': True, } response = self.client.post(self.url, data=data, follow=True) self.assertNotContains(response, self.context.teacher.contact.user_object.email) self.assertContains(response, volunteer.user_object.email) self.assertContains(response, specialstaffcontext.profile.user_object.email) assert_checkbox(response, "events", 0, special.pk, special.e_title, checked=False, prefix="event-select") assert_checkbox(response, "staff_areas", 0, staffcontext.area.pk, staffcontext.area.title, checked=False, prefix="event-select") assert_checkbox(response, "event_collections", 0, "Volunteer", "All Volunteer Events", prefix="event-select")