本文整理汇总了Python中courses.factories.CourseRunFactory.create_batch方法的典型用法代码示例。如果您正苦于以下问题:Python CourseRunFactory.create_batch方法的具体用法?Python CourseRunFactory.create_batch怎么用?Python CourseRunFactory.create_batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类courses.factories.CourseRunFactory
的用法示例。
在下文中一共展示了CourseRunFactory.create_batch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_course_with_runs
# 需要导入模块: from courses.factories import CourseRunFactory [as 别名]
# 或者: from courses.factories.CourseRunFactory import create_batch [as 别名]
def generate_course_with_runs(program, course_params=None, course_run_count=1):
"""
Helper method to generate a Course with CourseRuns for a Program
"""
course_params = course_params or {}
course = CourseFactory.create(program=program, **course_params)
course_runs = CourseRunFactory.create_batch(course_run_count, course=course)
return course, course_runs
示例2: test_has_paid_for_any_in_program
# 需要导入模块: from courses.factories import CourseRunFactory [as 别名]
# 或者: from courses.factories.CourseRunFactory import create_batch [as 别名]
def test_has_paid_for_any_in_program(self):
"""
Assert that has_paid_for_any_in_program returns True if any CourseRun associated with a Program has been
paid for.
"""
new_program = ProgramFactory.create()
new_course_runs = CourseRunFactory.create_batch(2, course__program=new_program)
mmtrack = MMTrack(
user=self.user,
program=new_program,
edx_user_data=self.cached_edx_user_data
)
assert mmtrack.has_paid_for_any_in_program() is False
fg = FinalGradeFactory.create(user=self.user, course_run=new_course_runs[0], course_run_paid_on_edx=True)
assert mmtrack.has_paid_for_any_in_program() is True
fg.delete()
FinalGradeFactory.create(user=self.user, course_run=new_course_runs[1], course_run_paid_on_edx=True)
assert mmtrack.has_paid_for_any_in_program() is True