本文整理汇总了Python中xmodule.modulestore.tests.factories.CourseFactory.has_started方法的典型用法代码示例。如果您正苦于以下问题:Python CourseFactory.has_started方法的具体用法?Python CourseFactory.has_started怎么用?Python CourseFactory.has_started使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmodule.modulestore.tests.factories.CourseFactory
的用法示例。
在下文中一共展示了CourseFactory.has_started方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestBetatesterAccess
# 需要导入模块: from xmodule.modulestore.tests.factories import CourseFactory [as 别名]
# 或者: from xmodule.modulestore.tests.factories.CourseFactory import has_started [as 别名]
class TestBetatesterAccess(ModuleStoreTestCase, CourseAccessTestMixin):
"""
Tests for the beta tester feature
"""
def setUp(self):
super(TestBetatesterAccess, self).setUp()
now = datetime.datetime.now(pytz.UTC)
tomorrow = now + datetime.timedelta(days=1)
self.course = CourseFactory(days_early_for_beta=2, start=tomorrow)
self.content = ItemFactory(parent=self.course)
self.normal_student = UserFactory()
self.beta_tester = BetaTesterFactory(course_key=self.course.id)
@patch.dict('courseware.access.settings.FEATURES', {'DISABLE_START_DATES': False})
def test_course_beta_period(self):
"""
Check that beta-test access works for courses.
"""
self.assertFalse(self.course.has_started())
self.assertCannotAccessCourse(self.normal_student, 'load', self.course)
self.assertCanAccessCourse(self.beta_tester, 'load', self.course)
@patch.dict('courseware.access.settings.FEATURES', {'DISABLE_START_DATES': False})
def test_content_beta_period(self):
"""
Check that beta-test access works for content.
"""
# student user shouldn't see it
self.assertFalse(has_access(self.normal_student, 'load', self.content, self.course.id))
# now the student should see it
self.assertTrue(has_access(self.beta_tester, 'load', self.content, self.course.id))
示例2: TestBetatesterAccess
# 需要导入模块: from xmodule.modulestore.tests.factories import CourseFactory [as 别名]
# 或者: from xmodule.modulestore.tests.factories.CourseFactory import has_started [as 别名]
class TestBetatesterAccess(ModuleStoreTestCase):
def setUp(self):
now = datetime.datetime.now(pytz.UTC)
tomorrow = now + datetime.timedelta(days=1)
self.course = CourseFactory(days_early_for_beta=2, start=tomorrow)
self.content = ItemFactory(parent=self.course)
self.normal_student = UserFactory()
self.beta_tester = BetaTesterFactory(course=self.course.location)
@patch.dict("courseware.access.settings.FEATURES", {"DISABLE_START_DATES": False})
def test_course_beta_period(self):
"""
Check that beta-test access works for courses.
"""
self.assertFalse(self.course.has_started())
# student user shouldn't see it
self.assertFalse(has_access(self.normal_student, self.course, "load"))
# now the student should see it
self.assertTrue(has_access(self.beta_tester, self.course, "load"))
@patch.dict("courseware.access.settings.FEATURES", {"DISABLE_START_DATES": False})
def test_content_beta_period(self):
"""
Check that beta-test access works for content.
"""
# student user shouldn't see it
self.assertFalse(has_access(self.normal_student, self.content, "load", self.course.id))
# now the student should see it
self.assertTrue(has_access(self.beta_tester, self.content, "load", self.course.id))