本文整理汇总了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)
示例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)