def testModulestoreImportLookups(self): testFilePath = os.path.join(os.path.dirname(__file__), 'data/modulestore_sample.json') pickleFilePath = os.path.join(os.path.dirname(__file__), 'data/modulestore_sample.pkl') importer = ModulestoreImporter(testFilePath, useCache=True, pickleCachePath=pickleFilePath) # The hash info: self.assertEqual(importer.getDisplayName("Introduction_to_Sociology"), 'Introduction to Sociology') self.assertEqual(importer.getDisplayName("0c6cf38317be42e0829d10cc68e7451b"), 'Quiz') self.assertEqual(importer.getDisplayName("0d6e5f3139e74c88adfdf4c90773f87f"), 'New Unit') self.assertEqual(importer.getOrg("0d6e5f3139e74c88adfdf4c90773f87f"), 'Medicine') self.assertEqual(importer.getCourseShortName("dc9cb4ff0c9241d2b9e075806490f992"), 'HRP258') self.assertEqual(importer.getCategory("Annotation"), 'annotatable') self.assertEqual(importer.getRevision("18b21999d6424f4ca04fe2bbe188fc9e"), 'draft') # Short coursenames to long coursenames: self.assertEqual(importer['SOC131'], 'LaneCollege/SOC131/Introduction_to_Sociology') self.assertEqual(importer.keys(), [u'SOC131']) self.assertEqual(importer.values(), [u'LaneCollege/SOC131/Introduction_to_Sociology']) self.assertEqual(importer.items(), [(u'SOC131', u'LaneCollege/SOC131/Introduction_to_Sociology')])