当前位置: 首页>>代码示例>>Python>>正文


Python XMLModuleStore.get_courses_for_wiki方法代码示例

本文整理汇总了Python中xmodule.modulestore.xml.XMLModuleStore.get_courses_for_wiki方法的典型用法代码示例。如果您正苦于以下问题:Python XMLModuleStore.get_courses_for_wiki方法的具体用法?Python XMLModuleStore.get_courses_for_wiki怎么用?Python XMLModuleStore.get_courses_for_wiki使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmodule.modulestore.xml.XMLModuleStore的用法示例。


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

示例1: test_get_courses_for_wiki

# 需要导入模块: from xmodule.modulestore.xml import XMLModuleStore [as 别名]
# 或者: from xmodule.modulestore.xml.XMLModuleStore import get_courses_for_wiki [as 别名]
    def test_get_courses_for_wiki(self):
        """
        Test the get_courses_for_wiki method
        """
        store = XMLModuleStore(DATA_DIR, source_dirs=['toy', 'simple'])
        for course in store.get_courses():
            course_locations = store.get_courses_for_wiki(course.wiki_slug)
            self.assertEqual(len(course_locations), 1)
            self.assertIn(course.location.course_key, course_locations)

        course_locations = store.get_courses_for_wiki('no_such_wiki')
        self.assertEqual(len(course_locations), 0)

        # now set toy course to share the wiki with simple course
        toy_course = store.get_course(CourseKey.from_string('edX/toy/2012_Fall'))
        toy_course.wiki_slug = 'simple'

        course_locations = store.get_courses_for_wiki('toy')
        self.assertEqual(len(course_locations), 0)

        course_locations = store.get_courses_for_wiki('simple')
        self.assertEqual(len(course_locations), 2)
        for course_number in ['toy', 'simple']:
            self.assertIn(CourseKey.from_string('/'.join(['edX', course_number, '2012_Fall'])), course_locations)
开发者ID:cmscom,项目名称:edx-platform,代码行数:26,代码来源:test_xml.py

示例2: test_get_courses_for_wiki

# 需要导入模块: from xmodule.modulestore.xml import XMLModuleStore [as 别名]
# 或者: from xmodule.modulestore.xml.XMLModuleStore import get_courses_for_wiki [as 别名]
    def test_get_courses_for_wiki(self):
        """
        Test the get_courses_for_wiki method
        """
        store = XMLModuleStore(DATA_DIR, course_dirs=['toy', 'simple'])
        for course in store.get_courses():
            course_locations = store.get_courses_for_wiki(course.wiki_slug)
            self.assertEqual(len(course_locations), 1)
            self.assertIn(course.location, course_locations)

        course_locations = store.get_courses_for_wiki('no_such_wiki')
        self.assertEqual(len(course_locations), 0)

        # now set toy course to share the wiki with simple course
        toy_course = store.get_course(SlashSeparatedCourseKey('edX', 'toy', '2012_Fall'))
        toy_course.wiki_slug = 'simple'

        course_locations = store.get_courses_for_wiki('toy')
        self.assertEqual(len(course_locations), 0)

        course_locations = store.get_courses_for_wiki('simple')
        self.assertEqual(len(course_locations), 2)
        for course_number in ['toy', 'simple']:
            self.assertIn(Location('edX', course_number, '2012_Fall', 'course', '2012_Fall'), course_locations)
开发者ID:AlexanderFuentes,项目名称:edx-platform,代码行数:26,代码来源:test_xml.py


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