def test_get_courses(self, _from_json): '''Make sure the course objects loaded properly''' courses = self.draft_store.get_courses() assert_equals(len(courses), 6) course_ids = [course.id for course in courses] for course_key in [ SlashSeparatedCourseKey(*fields) for fields in [ ['edX', 'simple', '2012_Fall'], ['edX', 'simple_with_draft', '2012_Fall'], ['edX', 'test_import_course', '2012_Fall'], ['edX', 'test_unicode', '2012_Fall'], ['edX', 'toy', '2012_Fall'], ['guestx', 'foo', 'bar'], ] ]: assert_in(course_key, course_ids) course = self.draft_store.get_course(course_key) assert_not_none(course) assert_true(self.draft_store.has_course(course_key)) mix_cased = SlashSeparatedCourseKey(course_key.org.upper(), course_key.course.upper(), course_key.run.lower()) assert_false(self.draft_store.has_course(mix_cased)) assert_true( self.draft_store.has_course(mix_cased, ignore_case=True))
def test_get_courses(self, _from_json): '''Make sure the course objects loaded properly''' courses = self.draft_store.get_courses() assert_equals(len(courses), 6) course_ids = [course.id for course in courses] for course_key in [ SlashSeparatedCourseKey(*fields) for fields in [ ['edX', 'simple', '2012_Fall'], ['edX', 'simple_with_draft', '2012_Fall'], ['edX', 'test_import_course', '2012_Fall'], ['edX', 'test_unicode', '2012_Fall'], ['edX', 'toy', '2012_Fall'], ['guestx', 'foo', 'bar'], ] ]: assert_in(course_key, course_ids) course = self.draft_store.get_course(course_key) assert_not_none(course) assert_true(self.draft_store.has_course(course_key)) mix_cased = SlashSeparatedCourseKey( course_key.org.upper(), course_key.course.upper(), course_key.run.lower() ) assert_false(self.draft_store.has_course(mix_cased)) assert_true(self.draft_store.has_course(mix_cased, ignore_case=True))
def test_unicode_loads(self): """ Test that getting items from the test_unicode course works """ assert_not_none( self.draft_store.get_item( BlockUsageLocator(CourseLocator('edX', 'test_unicode', '2012_Fall', deprecated=True), 'course', '2012_Fall', deprecated=True)), ) # All items with ascii-only filenames should load properly. assert_not_none( self.draft_store.get_item( BlockUsageLocator(CourseLocator('edX', 'test_unicode', '2012_Fall', deprecated=True), 'video', 'Welcome', deprecated=True)), ) assert_not_none( self.draft_store.get_item( BlockUsageLocator(CourseLocator('edX', 'test_unicode', '2012_Fall', deprecated=True), 'video', 'Welcome', deprecated=True)), ) assert_not_none( self.draft_store.get_item( BlockUsageLocator(CourseLocator('edX', 'test_unicode', '2012_Fall', deprecated=True), 'chapter', 'Overview', deprecated=True)), )
def test_unicode_loads(self): """ Test that getting items from the test_unicode course works """ assert_not_none(self.draft_store.get_item(Location("edX", "test_unicode", "2012_Fall", "course", "2012_Fall"))) # All items with ascii-only filenames should load properly. assert_not_none(self.draft_store.get_item(Location("edX", "test_unicode", "2012_Fall", "video", "Welcome"))) assert_not_none(self.draft_store.get_item(Location("edX", "test_unicode", "2012_Fall", "video", "Welcome"))) assert_not_none(self.draft_store.get_item(Location("edX", "test_unicode", "2012_Fall", "chapter", "Overview")))
def test_get_courses(self): '''Make sure the course objects loaded properly''' courses = self.store.get_courses() assert_equals(len(courses), 5) course_ids = [course.id for course in courses] for course_key in [ SlashSeparatedCourseKey(*fields) for fields in [ ['edX', 'simple', '2012_Fall'], ['edX', 'simple_with_draft', '2012_Fall'], ['edX', 'test_import_course', '2012_Fall'], ['edX', 'test_unicode', '2012_Fall'], ['edX', 'toy', '2012_Fall'] ] ]: assert_in(course_key, course_ids) course = self.store.get_course(course_key) assert_not_none(course)
def test_find_one(self): assert_not_none( self.draft_store._find_one( BlockUsageLocator(CourseLocator('edX', 'toy', '2012_Fall', deprecated=True), 'course', '2012_Fall', deprecated=True)), ) assert_not_none( self.draft_store._find_one( BlockUsageLocator(CourseLocator('edX', 'simple', '2012_Fall', deprecated=True), 'course', '2012_Fall', deprecated=True)), ) assert_not_none( self.draft_store._find_one( BlockUsageLocator(CourseLocator('edX', 'toy', '2012_Fall', deprecated=True), 'video', 'Welcome', deprecated=True)), )
def test_get_courses(self): '''Make sure the course objects loaded properly''' courses = self.draft_store.get_courses() # note, the number of courses expected is really # 6, but due to a lack of cache flushing between # test case runs, we will get back 7. # When we fix the caching issue, we should reduce this # to 6 and remove the 'treexport_peer_component' course_id # from the list below assert_equals(len(courses), 7) # pylint: disable=no-value-for-parameter course_ids = [course.id for course in courses] for course_key in [ SlashSeparatedCourseKey(*fields) for fields in [ ['edX', 'simple', '2012_Fall'], ['edX', 'simple_with_draft', '2012_Fall'], ['edX', 'test_import_course', '2012_Fall'], ['edX', 'test_unicode', '2012_Fall'], ['edX', 'toy', '2012_Fall'], ['guestx', 'foo', 'bar'], # This course below is due to a caching issue in the modulestore # which is not cleared between test runs. This means ['edX', 'treeexport_peer_component', 'export_peer_component'], ] ]: assert_in(course_key, course_ids) course = self.draft_store.get_course(course_key) assert_not_none(course) assert_true(self.draft_store.has_course(course_key)) mix_cased = SlashSeparatedCourseKey( course_key.org.upper(), course_key.course.upper(), course_key.run.lower() ) assert_false(self.draft_store.has_course(mix_cased)) assert_true(self.draft_store.has_course(mix_cased, ignore_case=True))
def test_get_courses(self, _from_json): '''Make sure the course objects loaded properly''' courses = self.draft_store.get_courses() # note, the number of courses expected is really # 6, but due to a lack of cache flushing between # test case runs, we will get back 7. # When we fix the caching issue, we should reduce this # to 6 and remove the 'treexport_peer_component' course_id # from the list below assert_equals(len(courses), 7) # pylint: disable=no-value-for-parameter course_ids = [course.id for course in courses] for course_key in [ SlashSeparatedCourseKey(*fields) for fields in [ ['edX', 'simple', '2012_Fall'], ['edX', 'simple_with_draft', '2012_Fall'], ['edX', 'test_import_course', '2012_Fall'], ['edX', 'test_unicode', '2012_Fall'], ['edX', 'toy', '2012_Fall'], ['guestx', 'foo', 'bar'], # This course below is due to a caching issue in the modulestore # which is not cleared between test runs. This means ['edX', 'treeexport_peer_component', 'export_peer_component'], ] ]: assert_in(course_key, course_ids) course = self.draft_store.get_course(course_key) assert_not_none(course) assert_true(self.draft_store.has_course(course_key)) mix_cased = SlashSeparatedCourseKey( course_key.org.upper(), course_key.course.upper(), course_key.run.lower() ) assert_false(self.draft_store.has_course(mix_cased)) assert_true(self.draft_store.has_course(mix_cased, ignore_case=True))
def test_unicode_loads(self): """ Test that getting items from the test_unicode course works """ assert_not_none( self.store.get_item(Location('edX', 'test_unicode', '2012_Fall', 'course', '2012_Fall')), ) # All items with ascii-only filenames should load properly. assert_not_none( self.store.get_item(Location('edX', 'test_unicode', '2012_Fall', 'video', 'Welcome')), ) assert_not_none( self.store.get_item(Location('edX', 'test_unicode', '2012_Fall', 'video', 'Welcome')), ) assert_not_none( self.store.get_item(Location('edX', 'test_unicode', '2012_Fall', 'chapter', 'Overview')), )
def test_unicode_loads(self): """ Test that getting items from the test_unicode course works """ assert_not_none( self.draft_store.get_item(Location('edX', 'test_unicode', '2012_Fall', 'course', '2012_Fall')), ) # All items with ascii-only filenames should load properly. assert_not_none( self.draft_store.get_item(Location('edX', 'test_unicode', '2012_Fall', 'video', 'Welcome')), ) assert_not_none( self.draft_store.get_item(Location('edX', 'test_unicode', '2012_Fall', 'video', 'Welcome')), ) assert_not_none( self.draft_store.get_item(Location('edX', 'test_unicode', '2012_Fall', 'chapter', 'Overview')), )
def test_get_courses(self): """Make sure the course objects loaded properly""" courses = self.draft_store.get_courses() assert_equals(len(courses), 6) course_ids = [course.id for course in courses] for course_key in [ SlashSeparatedCourseKey(*fields) for fields in [ ["edX", "simple", "2012_Fall"], ["edX", "simple_with_draft", "2012_Fall"], ["edX", "test_import_course", "2012_Fall"], ["edX", "test_unicode", "2012_Fall"], ["edX", "toy", "2012_Fall"], ] ]: assert_in(course_key, course_ids) course = self.draft_store.get_course(course_key) assert_not_none(course) assert_true(self.draft_store.has_course(course_key)) mix_cased = SlashSeparatedCourseKey( course_key.org.upper(), course_key.course.upper(), course_key.run.lower() ) assert_false(self.draft_store.has_course(mix_cased)) assert_true(self.draft_store.has_course(mix_cased, ignore_case=True))
def test_find_one(self): assert_not_none( self.draft_store._find_one(Location('edX', 'toy', '2012_Fall', 'course', '2012_Fall')), ) assert_not_none( self.draft_store._find_one(Location('edX', 'simple', '2012_Fall', 'course', '2012_Fall')), ) assert_not_none( self.draft_store._find_one(Location('edX', 'toy', '2012_Fall', 'video', 'Welcome')), )
def test_loads(self): assert_not_none( self.draft_store.get_item(Location('edX', 'toy', '2012_Fall', 'course', '2012_Fall')) ) assert_not_none( self.draft_store.get_item(Location('edX', 'simple', '2012_Fall', 'course', '2012_Fall')), ) assert_not_none( self.draft_store.get_item(Location('edX', 'toy', '2012_Fall', 'video', 'Welcome')), )
def test_loads(self): assert_not_none( self.draft_store.get_item(BlockUsageLocator(CourseLocator('edX', 'toy', '2012_Fall', deprecated=True), 'course', '2012_Fall', deprecated=True)) ) assert_not_none( self.draft_store.get_item(BlockUsageLocator(CourseLocator('edX', 'simple', '2012_Fall', deprecated=True), 'course', '2012_Fall', deprecated=True)), ) assert_not_none( self.draft_store.get_item(BlockUsageLocator(CourseLocator('edX', 'toy', '2012_Fall', deprecated=True), 'video', 'Welcome', deprecated=True)), )
def test_loads(self): assert_not_none(self.draft_store.get_item(Location("edX", "toy", "2012_Fall", "course", "2012_Fall"))) assert_not_none(self.draft_store.get_item(Location("edX", "simple", "2012_Fall", "course", "2012_Fall"))) assert_not_none(self.draft_store.get_item(Location("edX", "toy", "2012_Fall", "video", "Welcome")))
def test_find_one(self): assert_not_none(self.draft_store._find_one(Location("edX", "toy", "2012_Fall", "course", "2012_Fall"))) assert_not_none(self.draft_store._find_one(Location("edX", "simple", "2012_Fall", "course", "2012_Fall"))) assert_not_none(self.draft_store._find_one(Location("edX", "toy", "2012_Fall", "video", "Welcome")))