'Assert grades for given courses exist.'

def _assert_grades_exist_for_courses(self, course_keys, db_table=None):

    for course_key in course_keys:
        if ((db_table == 'course') or (db_table is None)):
            self.assertIsNotNone(PersistentCourseGrade.read(self.user_ids[0], course_key))
        if ((db_table == 'subsection') or (db_table is None)):
            for subsection_key in self.subsection_keys_by_course[course_key]:
                self.assertIsNotNone(PersistentSubsectionGrade.read_grade(self.user_ids[0], subsection_key))
