• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python factories.SampleCourseFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中xmodule.modulestore.tests.factories.SampleCourseFactory的典型用法代码示例。如果您正苦于以下问题:Python SampleCourseFactory类的具体用法?Python SampleCourseFactory怎么用?Python SampleCourseFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了SampleCourseFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setUp

    def setUp(self):
        """
        Set up courses and enrollments.
        """
        super(TestStudentViewsWithCCX, self).setUp()

        # Create a Draft Mongo and a Split Mongo course and enroll a student user in them.
        self.student_password = "foobar"
        self.student = UserFactory.create(username="test", password=self.student_password, is_staff=False)
        self.draft_course = SampleCourseFactory.create(default_store=ModuleStoreEnum.Type.mongo)
        self.split_course = SampleCourseFactory.create(default_store=ModuleStoreEnum.Type.split)
        CourseEnrollment.enroll(self.student, self.draft_course.id)
        CourseEnrollment.enroll(self.student, self.split_course.id)

        # Create a CCX coach.
        self.coach = AdminFactory.create()
        role = CourseCcxCoachRole(self.split_course.id)
        role.add_users(self.coach)

        # Create a CCX course and enroll the user in it.
        self.ccx = CcxFactory(course_id=self.split_course.id, coach=self.coach)
        last_week = datetime.datetime.now(UTC()) - datetime.timedelta(days=7)
        override_field_for_ccx(self.ccx, self.split_course, 'start', last_week)  # Required by self.ccx.has_started().
        self.ccx_course_key = CCXLocator.from_course_locator(self.split_course.id, self.ccx.id)
        CourseEnrollment.enroll(self.student, self.ccx_course_key)
开发者ID:Akif-Vohra,项目名称:edx-platform,代码行数:25,代码来源:test_views.py


示例2: setUpClass

    def setUpClass(cls):
        super(TestGetBlocks, cls).setUpClass()
        with cls.store.default_store(ModuleStoreEnum.Type.split):
            cls.course = SampleCourseFactory.create()

        # hide the html block
        cls.html_block = cls.store.get_item(cls.course.id.make_usage_key('html', 'html_x1a_1'))
        cls.html_block.visible_to_staff_only = True
        cls.store.update_item(cls.html_block, ModuleStoreEnum.UserID.test)
开发者ID:Lektorium-LLC,项目名称:edx-platform,代码行数:9,代码来源:test_api.py


示例3: test_hide_from_toc

    def test_hide_from_toc(self):
        course_key = SampleCourseFactory.create().id
        course_usage_key = self.store.make_course_usage_key(course_key)

        # hide chapter_x from TOC
        chapter_x_key = course_key.make_usage_key('chapter', 'chapter_x')
        chapter_x = self.store.get_item(chapter_x_key)
        chapter_x.hide_from_toc = True
        self.store.update_item(chapter_x, ModuleStoreEnum.UserID.test)

        block_structure = BlockStructureFactory.create_from_modulestore(course_usage_key, self.store)

        # collect phase
        BlockDepthTransformer.collect(block_structure)
        BlockNavigationTransformer.collect(block_structure)
        block_structure._collect_requested_xblock_fields()

        self.assertIn(chapter_x_key, block_structure)

        # transform phase
        BlockDepthTransformer().transform(usage_info=None, block_structure=block_structure)
        BlockNavigationTransformer(0).transform(usage_info=None, block_structure=block_structure)
        block_structure._prune_unreachable()

        self.assertIn(chapter_x_key, block_structure)

        course_descendants = block_structure.get_transformer_block_field(
            course_usage_key,
            BlockNavigationTransformer,
            BlockNavigationTransformer.BLOCK_NAVIGATION,
        )

        # chapter_y and its descendants should be included
        for block_key in [
                course_key.make_usage_key('chapter', 'chapter_y'),
                course_key.make_usage_key('sequential', 'sequential_y1'),
                course_key.make_usage_key('vertical', 'vertical_y1a'),
                course_key.make_usage_key('problem', 'problem_y1a_1'),
        ]:
            self.assertIn(unicode(block_key), course_descendants)

        # chapter_x and its descendants should not be included
        for block_key in [
                chapter_x_key,
                course_key.make_usage_key('sequential', 'sequential_x1'),
                course_key.make_usage_key('vertical', 'vertical_x1a'),
                course_key.make_usage_key('problem', 'problem_x1a_1'),
        ]:
            self.assertNotIn(unicode(block_key), course_descendants)
开发者ID:shevious,项目名称:edx-platform,代码行数:49,代码来源:test_navigation.py


示例4: setUpClass

 def setUpClass(cls):
     super(TestGetBlocksMobileHack, cls).setUpClass()
     with cls.store.default_store(ModuleStoreEnum.Type.split):
         cls.course = SampleCourseFactory.create(
             block_info_tree=[
                 BlockInfo('empty_chapter', 'chapter', {}, [
                     BlockInfo('empty_sequential', 'sequential', {}, [
                         BlockInfo('empty_vertical', 'vertical', {}, []),
                     ]),
                 ]),
                 BlockInfo('full_chapter', 'chapter', {}, [
                     BlockInfo('full_sequential', 'sequential', {}, [
                         BlockInfo('full_vertical', 'vertical', {}, [
                             BlockInfo('html', 'html', {}, []),
                         ]),
                     ]),
                 ])
             ]
         )
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:19,代码来源:test_api.py


示例5: setUp

 def setUp(self):
     super(TestBlockCountsTransformer, self).setUp()
     self.course_key = SampleCourseFactory.create().id
     self.course_usage_key = self.store.make_course_usage_key(self.course_key)
     self.block_structure = BlockStructureFactory.create_from_modulestore(self.course_usage_key, self.store)
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:5,代码来源:test_block_counts.py


示例6: _create_course

 def _create_course(self, store_type):
     """
     Creates the sample course in the given store type.
     """
     with self.store.default_store(store_type):
         return SampleCourseFactory.create()
开发者ID:Lektorium-LLC,项目名称:edx-platform,代码行数:6,代码来源:test_api.py


示例7: setUp

 def setUp(self):
     super(TestGetBlocks, self).setUp()
     self.course = SampleCourseFactory.create()
     self.user = UserFactory.create()
     self.request = RequestFactory().get("/dummy")
     self.request.user = self.user
开发者ID:Certific-NET,项目名称:edx-platform,代码行数:6,代码来源:test_api.py



注:本文中的xmodule.modulestore.tests.factories.SampleCourseFactory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python factories.ToyCourseFactory类代码示例发布时间:2022-05-26
下一篇:
Python factories.LibraryFactory类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap