Example #1
0
 def test_send_feedback_email_body_result_point_to_grade_mapper(self):
     testassignment = mommy.make_recipe('devilry.apps.core.assignment_activeperiod_start',
                                        points_to_grade_mapper=Assignment.POINTS_TO_GRADE_MAPPER_CUSTOM_TABLE,
                                        max_points=100,
                                        long_name='Assignment 1', parentnode__parentnode__long_name='Subject 1')
     point_to_grade_map = mommy.make(
         'core.PointToGradeMap',
         assignment=testassignment)
     mommy.make('core.PointRangeToGrade', point_to_grade_map=point_to_grade_map,
                minimum_points=0, maximum_points=19, grade='F')
     mommy.make('core.PointRangeToGrade', point_to_grade_map=point_to_grade_map,
                minimum_points=20, maximum_points=39, grade='E')
     mommy.make('core.PointRangeToGrade', point_to_grade_map=point_to_grade_map,
                minimum_points=40, maximum_points=59, grade='D')
     mommy.make('core.PointRangeToGrade', point_to_grade_map=point_to_grade_map,
                minimum_points=60, maximum_points=79, grade='C')
     mommy.make('core.PointRangeToGrade', point_to_grade_map=point_to_grade_map,
                minimum_points=80, maximum_points=89, grade='B')
     mommy.make('core.PointRangeToGrade', point_to_grade_map=point_to_grade_map,
                minimum_points=90, maximum_points=100, grade='A')
     test_feedbackset = group_mommy.feedbackset_first_attempt_published(
         group__parentnode=testassignment, deadline_datetime=timezone.now(),
         grading_published_datetime=timezone.now(), grading_points=60)
     student = mommy.make('core.Candidate', assignment_group=test_feedbackset.group)
     mommy.make('devilry_account.UserEmail', user=student.relatedstudent.user, email='*****@*****.**')
     feedback_email.send_feedback_email(
         assignment=test_feedbackset.group.parentnode,
         feedback_sets=[test_feedbackset],
         domain_url_start='http://www.example.com/',
         feedback_type='feedback_created')
     self.assertEqual(len(mail.outbox), 1)
     self.assertEqual(
         htmls.S(mail.outbox[0].message().as_string()).one(
             '.devilry_email_feedback_result').alltext_normalized,
         'Result: C ( passed )')
Example #2
0
 def test_send_feedback_email_recipients(self):
     test_feedbackset = self.__setup_feedback_set()
     feedback_email.send_feedback_email(
         assignment=test_feedbackset.group.parentnode,
         feedback_sets=[test_feedbackset],
         domain_url_start='http://www.example.com/',
         feedback_type='feedback_created')
     self.assertEqual(
         mail.outbox[0].recipients(),
         ['*****@*****.**'])
Example #3
0
 def test_send_feedback_email_subject(self):
     test_feedbackset = self.__setup_feedback_set()
     feedback_email.send_feedback_email(
         assignment=test_feedbackset.group.parentnode,
         feedback_sets=[test_feedbackset],
         domain_url_start='http://www.example.com/',
         feedback_type='feedback_created')
     self.assertEqual(
         mail.outbox[0].subject,
         '[Devilry] Feedback for {}'.format(test_feedbackset.group.parentnode.long_name))
Example #4
0
 def test_send_feedback_email_body_result(self):
     test_feedbackset = self.__setup_feedback_set()
     feedback_email.send_feedback_email(
         assignment=test_feedbackset.group.parentnode,
         feedback_sets=[test_feedbackset],
         domain_url_start='http://www.example.com/',
         feedback_type='feedback_created')
     self.assertEqual(
         htmls.S(mail.outbox[0].message().as_string()).one(
             '.devilry_email_feedback_result').alltext_normalized,
         'Result: 1/1 ( passed )')
Example #5
0
 def test_send_feedback_email_body_deadline_datetime(self):
     test_feedbackset = self.__setup_feedback_set(deadline_datetime=datetime.utcnow())
     feedback_email.send_feedback_email(
         assignment=test_feedbackset.group.parentnode,
         feedback_sets=[test_feedbackset],
         domain_url_start='http://www.example.com/',
         feedback_type='feedback_created')
     self.assertEqual(
         htmls.S(mail.outbox[0].message().as_string()).one(
             '.devilry_email_feedback_deadline_datetime').alltext_normalized,
         'Deadline datetime: {}'.format(
             defaultfilters.date(test_feedbackset.deadline_datetime, 'DATETIME_FORMAT')))
Example #6
0
 def test_send_feedback_email_body_link(self):
     test_feedbackset = self.__setup_feedback_set()
     feedback_email.send_feedback_email(
         assignment=test_feedbackset.group.parentnode,
         feedback_sets=[test_feedbackset],
         domain_url_start='http://www.example.com/',
         feedback_type='feedback_created')
     feedback_link = 'http://www.example.com/devilry_group/student/{}/feedbackfeed/'.format(
         test_feedbackset.group.id)
     self.assertEqual(
         htmls.S(mail.outbox[0].message().as_string()).one('.devilry_email_feedback_detail_text').alltext_normalized,
         'See the delivery feed for more details:')
     self.assertEqual(
         htmls.S(mail.outbox[0].message().as_string()).one(
             '.devilry_email_feedback_detail_url').alltext_normalized,
         feedback_link)