'Tests that CSV grade report works if unicode in headers.'

@patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task')
@patch('lms.djangoapps.grades.new.course_grade_factory.CourseGradeFactory.iter')
def test_unicode_in_csv_header(self, mock_grades_iter, _mock_current_task):

    mock_course_grade = MagicMock()
    mock_course_grade.summary = {'section_breakdown': [{'label': u'\u8282\u540e\u9898    01'}]}
    mock_course_grade.letter_grade = None
    mock_course_grade.percent = 0
    mock_grades_iter.return_value = [(self.create_student('username', 'student@example.com'), mock_course_grade, None)]
    result = CourseGradeReport.generate(None, None, self.course.id, None, 'graded')
    self.assertDictContainsSubset({'attempted': 1, 'succeeded': 1, 'failed': 0}, result)
