def initdb(): # connect to the db store = MongoModuleStore(HOST, DB, COLLECTION, FS_ROOT, RENDER_TEMPLATE, default_class=DEFAULT_CLASS) # since MongoModuleStore and MongoContentStore are basically assumed to be together, create this class # as well content_store = MongoContentStore(HOST, DB) # # Also test draft store imports # draft_store = DraftModuleStore(HOST, DB, COLLECTION, FS_ROOT, RENDER_TEMPLATE, default_class=DEFAULT_CLASS) # Explicitly list the courses to load (don't want the big one) courses = ['toy', 'simple', 'simple_with_draft', 'test_unicode'] import_from_xml(store, DATA_DIR, courses, draft_store=draft_store, static_content_store=content_store) # also test a course with no importing of static content import_from_xml( store, DATA_DIR, ['test_import_course'], static_content_store=content_store, do_import_static=False, verbose=True ) return store, content_store, draft_store
def initdb(): # connect to the db store = MongoModuleStore(HOST, DB, COLLECTION, FS_ROOT, RENDER_TEMPLATE, default_class=DEFAULT_CLASS) # Explicitly list the courses to load (don't want the big one) courses = ['toy', 'simple'] import_from_xml(store, DATA_DIR, courses) return store
def setUp(self): self.db_config['collection'] = 'modulestore{0}'.format(uuid.uuid4().hex[:5]) self.old_mongo = MongoModuleStore(self.db_config, **self.modulestore_options) self.draft_mongo = DraftMongoModuleStore(self.db_config, **self.modulestore_options) self.addCleanup(self.tear_down_mongo) self.course_location = None
def initdb(): # connect to the db doc_store_config = { 'host': HOST, 'db': DB, 'collection': COLLECTION, } store = MongoModuleStore(doc_store_config, FS_ROOT, RENDER_TEMPLATE, default_class=DEFAULT_CLASS) # since MongoModuleStore and MongoContentStore are basically assumed to be together, create this class # as well content_store = MongoContentStore(HOST, DB) # # Also test draft store imports # draft_store = DraftModuleStore(doc_store_config, FS_ROOT, RENDER_TEMPLATE, default_class=DEFAULT_CLASS) import_from_xml(store, DATA_DIR, TestMongoModuleStore.courses, draft_store=draft_store, static_content_store=content_store) # also test a course with no importing of static content import_from_xml( store, DATA_DIR, ['test_import_course'], static_content_store=content_store, do_import_static=False, verbose=True ) return store, content_store, draft_store
def test_mongo_modulestore_type(self): store = MongoModuleStore(HOST, DB, COLLECTION, FS_ROOT, RENDER_TEMPLATE, default_class=DEFAULT_CLASS) assert_equals(store.get_modulestore_type('foo/bar/baz'), 'mongo')
def test_mongo_modulestore_type(self): store = MongoModuleStore( { 'host': HOST, 'db': DB, 'collection': COLLECTION }, FS_ROOT, RENDER_TEMPLATE, default_class=DEFAULT_CLASS) assert_equals(store.get_modulestore_type('foo/bar/baz'), 'mongo')
def setUp(self): self.db_config['collection'] = 'modulestore{0}'.format( uuid.uuid4().hex[:5]) self.userid = random.getrandbits(32) super(TestOrphan, self).setUp() self.split_mongo = SplitMongoModuleStore(self.db_config, **self.modulestore_options) self.addCleanup(self.tear_down_split) self.old_mongo = MongoModuleStore(self.db_config, **self.modulestore_options) self.addCleanup(self.tear_down_mongo) self.course_location = None self._create_course()
def setUp(self): self.db_config['collection'] = 'modulestore{0}'.format(uuid.uuid4().hex[:5]) self.userid = random.getrandbits(32) super(SplitWMongoCourseBoostrapper, self).setUp() self.split_mongo = SplitMongoModuleStore( self.db_config, **self.modulestore_options ) self.addCleanup(self.split_mongo.db.connection.close) self.addCleanup(self.tear_down_split) self.old_mongo = MongoModuleStore(self.db_config, **self.modulestore_options) self.draft_mongo = DraftMongoModuleStore(self.db_config, **self.modulestore_options) self.addCleanup(self.tear_down_mongo) self.old_course_key = None self.runtime = None self._create_course()