Exemple #1
0
 def test_volunteer_conflict_sends_notification_w_bid_details(self):
     privileged_profile = ProfileFactory()
     grant_privilege(privileged_profile.user_object, 'Class Reviewers')
     EmailTemplate.objects.all().delete()
     subject_format = "bidder: %s, bid: %s"
     EmailTemplateSenderFactory(
         from_email="*****@*****.**",
         template__name='class submission notification',
         template__subject="bidder: %s, bid: %s" %
         ("{{ bidder }}", "{{ bid.b_title }}"))
     url = reverse(self.view_name, urlconf='gbe.urls')
     login_as(self.performer.performer_profile, self)
     data = {
         'theclass-teacher': self.performer.pk,
         'theclass-b_title': 'A class',
         'theclass-b_description': 'a description',
         'theclass-length_minutes': 60,
         'theclass-maximum_enrollment': 20,
         'theclass-fee': 0,
         'theclass-schedule_constraints': ['0'],
         'submit': 1,
     }
     response = self.client.post(url, data=data, follow=True)
     assert_right_mail_right_addresses(
         0,
         1,
         "bidder: %s, bid: %s" %
         (str(self.performer.performer_profile), data['theclass-b_title']),
         [privileged_profile.contact_email],
         from_email="*****@*****.**")
    def test_act_accept_act_link_correct(self):
        # accepted -> accepted
        # change show, loose rehearsal
        # same role
        rehearsal_event = self.context._schedule_rehearsal(
            self.context.sched_event, act=self.context.act)
        EmailTemplateSenderFactory(
            from_email="*****@*****.**",
            template__name='act accepted - %s' % self.show.e_title.lower(),
            template__subject="test template",
            template__content="stuff {{ act_tech_link }} more stuff")
        login_as(self.privileged_user, self)
        self.data['accepted'] = '3'

        response = self.client.post(self.url, data=self.data, follow=True)
        assert_email_contents(
            reverse('act_tech_wizard',
                    args=[self.context.act.pk],
                    urlconf='gbe.urls'))
        with self.assertRaises(ResourceAllocation.DoesNotExist):
            rehearsal_booking = ResourceAllocation.objects.get(
                event=rehearsal_event)
        assert_alert_exists(
            response, 'success', 'Success',
            "%s<br>Performer/Act: %s - %s<br>State: %s<br>Show: %s" %
            (act_status_change_msg, self.context.act.performer.name,
             self.context.act.b_title, "Accepted", self.show.e_title))
 def setUp(self):
     self.client = Client()
     self.privileged_profile = ProfileFactory()
     self.sender = EmailTemplateSenderFactory(
         from_email="*****@*****.**",
         template__name='volunteer schedule update',
         template__subject="test template")
     self.url = reverse(self.view_name,
                        args=[self.sender.template.name],
                        urlconf="gbe.email.urls")
 def test_act_waitlist_sends_notification_has_template(self):
     EmailTemplateSenderFactory(from_email="*****@*****.**",
                                template__name='act wait list',
                                template__subject="test template")
     url = reverse(self.view_name,
                   args=[self.context.act.pk],
                   urlconf='gbe.urls')
     login_as(self.privileged_user, self)
     response = self.client.post(url, data=self.data)
     assert_email_template_used("test template", "*****@*****.**")
 def test_act_accept_notification_template_fail(self):
     # accepted -> accepted - error case
     # change show, same role
     EmailTemplateSenderFactory(
         from_email="*****@*****.**",
         template__name='act accepted - %s' % self.show.e_title.lower(),
         template__subject="test template {% url 'gbehome' %}")
     login_as(self.privileged_user, self)
     self.data['accepted'] = '3'
     response = self.client.post(self.url, data=self.data, follow=True)
     self.assertContains(response, bidder_email_fail_msg)
 def test_act_accept_notification_template_fail(self):
     EmailTemplateSenderFactory(
         from_email="*****@*****.**",
         template__name='act accepted - %s' % self.show.e_title.lower(),
         template__subject="test template {% url 'gbehome' %}")
     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(url, data=self.data, follow=True)
     self.assertContains(response, bidder_email_fail_msg)
Exemple #7
0
 def test_post_form_edit_notification_template_fail(self):
     EmailTemplateSenderFactory(
         from_email="*****@*****.**",
         template__name='volunteer schedule update',
         template__subject="test template",
         template__content="stuff {% url 'gbehome' %}  more stuff")
     new_volunteer = ProfileFactory()
     data = self.get_edit_data()
     data['worker'] = new_volunteer.pk,
     data['role'] = 'Producer',
     login_as(self.privileged_profile, self)
     response = self.client.post(self.url, data=data, follow=True)
     self.assertContains(response, volunteer_allocate_email_fail_msg)
 def test_act_accept_has_template_per_show(self):
     EmailTemplateSenderFactory(from_email="*****@*****.**",
                                template__name='act accepted - %s' %
                                self.show.e_title.lower(),
                                template__subject="test template")
     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(url, data=self.data)
     assert_email_template_used("test template", "*****@*****.**")
     assert_email_recipient([(self.context.performer.contact.contact_email)
                             ])
 def test_act_accept_act_link_correct(self):
     EmailTemplateSenderFactory(
         from_email="*****@*****.**",
         template__name='act accepted - %s' % self.show.e_title.lower(),
         template__subject="test template",
         template__content="stuff {{ act_tech_link }} more stuff")
     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(url, data=self.data)
     assert_email_contents(
         reverse('act_techinfo_edit',
                 args=[self.context.act.pk],
                 urlconf='gbe.urls'))
 def test_volunteer_accept_sends_notification_has_template(self):
     EmailTemplateSenderFactory(
         from_email="*****@*****.**",
         template__name='volunteer schedule update',
         template__subject="test template"
     )
     url = reverse(self.view_name,
                   args=[self.volunteer.pk],
                   urlconf='gbe.urls')
     login_as(self.privileged_user, self)
     data = {'conference': self.volunteer.b_conference,
             'events': [],
             'accepted': 3}
     response = self.client.post(url, data=data)
     assert_email_template_used(
         "test template", "*****@*****.**")
 def test_volunteer_withdraw_sends_notification_fail(self):
     ProfilePreferencesFactory(profile=self.volunteer.profile)
     EmailTemplateSenderFactory(
         from_email="*****@*****.**",
         template__name='volunteer withdrawn',
         template__subject="test template {% url 'gbehome' %}"
     )
     url = reverse(self.view_name,
                   args=[self.volunteer.pk],
                   urlconf='gbe.urls')
     login_as(self.privileged_user, self)
     data = {'conference': self.volunteer.b_conference,
             'events': [],
             'accepted': 4}
     response = self.client.post(url, data=data, follow=True)
     self.assertContains(response,
                         bidder_email_fail_msg)
 def test_volunteer_conflict_sends_notification_w_bid_details(self):
     EmailTemplate.objects.all().delete()
     subject_format = "bidder: %s, bid: %s"
     EmailTemplateSenderFactory(
         from_email="*****@*****.**",
         template__name='volunteer update notification',
         template__subject="bidder: %s, bid: %s" % (
             "{{ bidder }}",
             "{{ bid.b_title }}")
     )
     response, context = self.post_conflict(staff=True)
     assert_right_mail_right_addresses(
         2,
         3,
         "bidder: %s, bid: %s" % (
             str(context.profile),
             'title'),
         [self.privileged_profile.contact_email],
         from_email="*****@*****.**")
Exemple #13
0
 def test_post_form_valid_notification_template_fail(self):
     EmailTemplateSenderFactory(
         from_email="*****@*****.**",
         template__name='volunteer schedule update',
         template__subject="test template",
         template__content="stuff {% url 'gbehome' %}  more stuff")
     data = self.get_edit_data()
     data['delete'] = 1
     login_as(self.privileged_profile, self)
     response = self.client.post(self.url, data=data, follow=True)
     self.assertRedirects(
         response, "%s?worker_open=True&changed_id=%d" %
         (reverse('edit_volunteer',
                  urlconf='gbe.scheduling.urls',
                  args=[
                      self.context.conference.conference_slug,
                      self.volunteer_opp.pk
                  ]), self.alloc.pk))
     self.assertContains(response, volunteer_allocate_email_fail_msg)
 def test_act_changestate_book_act_with_conflict(self):
     # accepted -> waitlist (#2, see above)
     # change show, change role
     EmailTemplateSenderFactory(from_email="*****@*****.**",
                                template__name='act wait list',
                                template__subject="test template")
     grant_privilege(self.privileged_user, 'Act Reviewers')
     conflict = SchedEventFactory(
         starttime=self.context.sched_event.starttime)
     EventLabelFactory(event=conflict,
                       text=self.context.conference.conference_slug)
     ResourceAllocationFactory(
         event=conflict,
         resource=WorkerFactory(
             _item=self.context.performer.performer_profile))
     login_as(self.privileged_user, self)
     response = self.client.post(self.url, data=self.data, follow=True)
     self.assertContains(response,
                         "Conflicting booking: %s" % str(conflict))
     assert_email_template_used("test template", "*****@*****.**")