'Test that we generate the correct grade report when dealing with A/B tests.
In order to verify that the behavior of the grade report is correct, we submit answers for problems
that the student won\'t have access to. A/B tests won\'t restrict access to the problems, but it should
not show up in that student\'s course tree when generating the grade report, hence the Not Available\'s
in the grade report.'

def test_problem_grade_report(self):

    self.submit_student_answer(self.student_a.username, self.problem_a_url, [self.OPTION_1, self.OPTION_1])
    self.submit_student_answer(self.student_a.username, self.problem_b_url, [self.OPTION_1, self.OPTION_1])
    self.submit_student_answer(self.student_b.username, self.problem_a_url, [self.OPTION_1, self.OPTION_2])
    self.submit_student_answer(self.student_b.username, self.problem_b_url, [self.OPTION_1, self.OPTION_2])
    with patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task'):
        result = ProblemGradeReport.generate(None, None, self.course.id, None, 'graded')
        self.assertDictContainsSubset({'action_name': 'graded', 'attempted': 2, 'succeeded': 2, 'failed': 0}, result)
    problem_names = [u'Homework    1:    Subsection    -    problem_a_url', u'Homework    1:    Subsection    -    problem_b_url']
    header_row = [u'Student    ID', u'Email', u'Username', u'Enrollment    Status', u'Grade']
    for problem in problem_names:
        header_row += [(problem + '    (Earned)'), (problem + '    (Possible)')]
    self.verify_rows_in_csv([dict(zip(header_row, [unicode(self.student_a.id), self.student_a.email, self.student_a.username, ENROLLED_IN_COURSE, u'1.0', u'2.0', u'2.0', u'Not    Available', u'Not    Available'])), dict(zip(header_row, [unicode(self.student_b.id), self.student_b.email, self.student_b.username, ENROLLED_IN_COURSE, u'0.5', u'Not    Available', u'Not    Available', u'1.0', u'2.0']))])
