def create_rows(self): self.create_student('student1', self.EMAIL_WITH_ID) self.create_student('student2', self.EMAIL_WITHOUT_ID) self.current_task = Mock() self.current_task.update_state = Mock() with patch( 'lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task' ) as mock_current_task: mock_current_task.return_value = self.current_task CourseGradeReport.generate(None, None, self.course.id, None, 'graded')
def test_one_group_problem(self): """ Verify that grade export works when only the Group A user partition receives a problem. We expect to see a column for the homework where student_a's entry includes their grade, and student b's entry shows a 0. """ problem_a_url = 'problem_a_url' self.define_option_problem(problem_a_url, parent=self.vertical_a) self.submit_student_answer(self.student_a.username, problem_a_url, [OPTION_1, OPTION_1]) with patch( 'lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task' ): result = CourseGradeReport.generate(None, None, self.course.id, None, 'graded') self.verify_csv_task_success(result) self.verify_grades_in_csv([ { self.student_a: { u'Grade': '1.0', u'Homework': '1.0', }, }, { self.student_b: { u'Grade': '0.0', u'Homework': u'Not Available', } }, ], ignore_other_columns=True)
def test_one_group_problem(self): """ Verify that grade export works when only the Group A user partition receives a problem. We expect to see a column for the homework where student_a's entry includes their grade, and student b's entry shows a 0. """ problem_a_url = 'problem_a_url' self.define_option_problem(problem_a_url, parent=self.vertical_a) self.submit_student_answer(self.student_a.username, problem_a_url, [OPTION_1, OPTION_1]) with patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task'): result = CourseGradeReport.generate(None, None, self.course.id, None, 'graded') self.verify_csv_task_success(result) self.verify_grades_in_csv( [ { self.student_a: { u'Grade': '1.0', u'Homework': '1.0', }, }, { self.student_b: { u'Grade': '0.0', u'Homework': u'Not Attempted', } }, ], ignore_other_columns=True )
def test_both_groups_problems(self): """ Verify that grade export works when each user partition receives (different) problems. Each user's grade on their particular problem should show up in the grade report. """ problem_a_url = 'problem_a_url' problem_b_url = 'problem_b_url' self.define_option_problem(problem_a_url, parent=self.vertical_a) self.define_option_problem(problem_b_url, parent=self.vertical_b) # student A will get 100%, student B will get 50% because # OPTION_1 is the correct option, and OPTION_2 is the # incorrect option self.submit_student_answer(self.student_a.username, problem_a_url, [OPTION_1, OPTION_1]) self.submit_student_answer(self.student_b.username, problem_b_url, [OPTION_1, OPTION_2]) with patch( 'lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task' ): result = CourseGradeReport.generate(None, None, self.course.id, None, 'graded') self.verify_csv_task_success(result) self.verify_grades_in_csv( [ { self.student_a: { u'Grade': '1.0', u'Homework': '1.0', } }, { self.student_b: { u'Grade': '0.5', u'Homework': '0.5', } }, ], ignore_other_columns=True, )
def test_both_groups_problems(self): """ Verify that grade export works when each user partition receives (different) problems. Each user's grade on their particular problem should show up in the grade report. """ problem_a_url = 'problem_a_url' problem_b_url = 'problem_b_url' self.define_option_problem(problem_a_url, parent=self.vertical_a) self.define_option_problem(problem_b_url, parent=self.vertical_b) # student A will get 100%, student B will get 50% because # OPTION_1 is the correct option, and OPTION_2 is the # incorrect option self.submit_student_answer(self.student_a.username, problem_a_url, [OPTION_1, OPTION_1]) self.submit_student_answer(self.student_b.username, problem_b_url, [OPTION_1, OPTION_2]) with patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task'): result = CourseGradeReport.generate(None, None, self.course.id, None, 'graded') self.verify_csv_task_success(result) self.verify_grades_in_csv( [ { self.student_a: { u'Grade': '1.0', u'Homework': '1.0', } }, { self.student_b: { u'Grade': '0.5', u'Homework': '0.5', } }, ], ignore_other_columns=True, )