'Verifies that whether a learner has a failing grade in the database or the grade is
calculated on the fly, a failing grade will result in a Certificate Eligibility of
"N" in the report.
Also confirms that a persisted passing grade will result in a Certificate Eligibility
of "Y."'

def test_certificate_eligibility(self):

    course = CourseFactory.create()
    user = CourseEnrollment.enroll(UserFactory.create(), course.id)
    self._verify_cell_data_for_user(user.username, course.id, 'Certificate    Eligible', 'N', num_rows=1)
    grading_policy_hash = GradesTransformer.grading_policy_hash(course)
    PersistentCourseGrade.update_or_create(user_id=user.user_id, course_id=course.id, passed=False, percent_grade=0.0, grading_policy_hash=grading_policy_hash)
    self._verify_cell_data_for_user(user.username, course.id, 'Certificate    Eligible', 'N', num_rows=1)
    PersistentCourseGrade.update_or_create(user_id=user.user_id, course_id=course.id, passed=True, percent_grade=0.8, letter_grade='pass', grading_policy_hash=grading_policy_hash)
    self._verify_cell_data_for_user(user.username, course.id, 'Certificate    Eligible', 'Y', num_rows=1)
