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)
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)
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)
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)