示例#1
0
 def test_send_email_success_email_sent(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(staffcontext.staff_lead, self)
     data = {
         'to': volunteer.user_object.email,
         'sender': staffcontext.staff_lead.user_object.email,
         'subject': "Subject",
         'html_message': "<p>Test Message</p>",
         'email-select-conference': [self.context.conference.pk],
         'email-select-roles': [
             "Volunteer",
         ],
         '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_queued_email(
         [
             volunteer.user_object.email,
         ],
         data['subject'],
         data['html_message'],
         data['sender'],
     )
示例#2
0
 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")
示例#3
0
 def test_send_email_success_email_sent(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(staffcontext.staff_lead, self)
     data = {
         'to': volunteer.user_object.email,
         'sender': staffcontext.staff_lead.user_object.email,
         'subject': "Subject",
         'html_message': "<p>Test Message</p>",
         'email-select-conference': [self.context.conference.pk],
         'email-select-roles': ["Volunteer", ],
         '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_queued_email(
         [volunteer.user_object.email, ],
         data['subject'],
         data['html_message'],
         data['sender'],
         )
示例#4
0
 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")
示例#5
0
 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")
示例#6
0
 def test_pick_performer_mismatch_show(self):
     showcontext = ShowContext()
     anothershowcontext = ShowContext()
     producer = showcontext.set_producer()
     login_as(producer, self)
     data = {
         'email-select-conference': [anothershowcontext.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.assertContains(
         response,
         "%d is not one of the available choices." % showcontext.show.pk)
示例#7
0
 def test_pick_performer_mismatch_show(self):
     showcontext = ShowContext()
     anothershowcontext = ShowContext()
     producer = showcontext.set_producer()
     login_as(producer, self)
     data = {
         'email-select-conference': [anothershowcontext.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.assertContains(
         response,
         "%d is not one of the available choices." % showcontext.show.pk)
示例#8
0
 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")
示例#9
0
 def test_pick_performer_reduced_priv(self):
     showcontext = ShowContext()
     showcontext.show.e_title = "0 Pick Perf"
     showcontext.show.save()
     producer = showcontext.set_producer()
     anothershowcontext = ShowContext(conference=showcontext.conference, )
     anothershowcontext.show.e_title = "1 Pick Perf"
     anothershowcontext.show.save()
     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)
     self.assert_checkbox(response,
                          "events",
                          0,
                          showcontext.show.pk,
                          showcontext.show.e_title,
                          checked=False,
                          prefix="event-select")
     self.assert_checkbox(response,
                          "events",
                          1,
                          anothershowcontext.show.pk,
                          anothershowcontext.show.e_title,
                          checked=False,
                          prefix="event-select")