def setUpTestData(cls):
cls.user = UserFactory.create()
# Create Programs, Courses, CourseRuns...
cls.p1_course_run_keys = ['p1_course_run']
cls.p2_course_run_keys = ['p2_course_run_1', 'p2_course_run_2']
cls.p1_course_run = CourseRunFactory.create(edx_course_key=cls.p1_course_run_keys[0])
p2 = FullProgramFactory.create()
first_course = p2.course_set.first()
extra_course = CourseFactory.create(program=p2)
cls.p2_course_run_1 = CourseRunFactory.create(course=first_course, edx_course_key=cls.p2_course_run_keys[0])
cls.p2_course_run_2 = CourseRunFactory.create(course=extra_course, edx_course_key=cls.p2_course_run_keys[1])
all_course_runs = [cls.p1_course_run, cls.p2_course_run_1, cls.p2_course_run_2]
# Create cached edX data
cls.enrollments = [
CachedEnrollmentFactory.create(user=cls.user, course_run=course_run) for course_run in all_course_runs
]
cls.certificates = [
CachedCertificateFactory.create(user=cls.user, course_run=course_run) for course_run in all_course_runs
]
cls.current_grades = [
CachedCurrentGradeFactory.create(user=cls.user, course_run=course_run) for course_run in all_course_runs
]
评论列表
文章目录