コード例 #1
0
 def drop_mongo_collections():
     """
     If using a Mongo-backed modulestore & contentstore, drop the collections.
     """
     module_store = modulestore()
     if hasattr(module_store, '_drop_database'):
         module_store._drop_database()  # pylint: disable=protected-access
     _CONTENTSTORE.clear()
コード例 #2
0
 def drop_mongo_collections():
     """
     If using a Mongo-backed modulestore & contentstore, drop the collections.
     """
     module_store = modulestore()
     if hasattr(module_store, '_drop_database'):
         module_store._drop_database()  # pylint: disable=protected-access
     _CONTENTSTORE.clear()
コード例 #3
0
def clear_courses():
    # Flush and initialize the module store
    # Note that if your test module gets in some weird state
    # (though it shouldn't), do this manually
    # from the bash shell to drop it:
    # $ mongo test_xmodule --eval "db.dropDatabase()"
    modulestore()._drop_database()  # pylint: disable=protected-access
    _CONTENTSTORE.clear()
    clear_existing_modulestores()
コード例 #4
0
def reset_databases(scenario):
    '''
    After each scenario, all databases are cleared/dropped.  Contentstore data are stored in unique databases
    whereas modulestore data is in unique collection names.  This data is created implicitly during the scenarios.
    If no data is created during the test, these lines equivilently do nothing.
    '''
    xmodule.modulestore.django.modulestore()._drop_database()  # pylint: disable=protected-access
    xmodule.modulestore.django.clear_existing_modulestores()
    _CONTENTSTORE.clear()
コード例 #5
0
ファイル: browser.py プロジェクト: Certific-NET/edx-platform
def reset_databases(scenario):
    '''
    After each scenario, all databases are cleared/dropped.  Contentstore data are stored in unique databases
    whereas modulestore data is in unique collection names.  This data is created implicitly during the scenarios.
    If no data is created during the test, these lines equivilently do nothing.
    '''
    xmodule.modulestore.django.modulestore()._drop_database()  # pylint: disable=protected-access
    xmodule.modulestore.django.clear_existing_modulestores()
    _CONTENTSTORE.clear()
コード例 #6
0
def clear_courses():
    # Flush and initialize the module store
    # Note that if your test module gets in some weird state
    # (though it shouldn't), do this manually
    # from the bash shell to drop it:
    # $ mongo test_xmodule --eval "db.dropDatabase()"
    modulestore()._drop_database()  # pylint: disable=protected-access
    _CONTENTSTORE.clear()
    clear_existing_modulestores()
コード例 #7
0
def reset_databases(scenario):
    '''
    After each scenario, all databases are cleared/dropped.  Contentstore data are stored in unique databases
    whereas modulestore data is in unique collection names.  This data is created implicitly during the scenarios.
    If no data is created during the test, these lines equivilently do nothing.
    '''
    mongo = MongoClient()
    mongo.drop_database(settings.CONTENTSTORE['OPTIONS']['db'])
    _CONTENTSTORE.clear()
    modulestore = xmodule.modulestore.django.modulestore()
    modulestore.collection.drop()
    xmodule.modulestore.django._MODULESTORES.clear()
コード例 #8
0
ファイル: browser.py プロジェクト: Mtax/MHST2013-14
def reset_databases(scenario):
    '''
    After each scenario, all databases are cleared/dropped.  Contentstore data are stored in unique databases
    whereas modulestore data is in unique collection names.  This data is created implicitly during the scenarios.
    If no data is created during the test, these lines equivilently do nothing.
    '''
    mongo = MongoClient()
    mongo.drop_database(settings.CONTENTSTORE['OPTIONS']['db'])
    _CONTENTSTORE.clear()
    modulestore = xmodule.modulestore.django.modulestore()
    modulestore.collection.drop()
    xmodule.modulestore.django._MODULESTORES.clear()
コード例 #9
0
def reset_databases(scenario):
    '''
    After each scenario, all databases are cleared/dropped.  Contentstore data are stored in unique databases
    whereas modulestore data is in unique collection names.  This data is created implicitly during the scenarios.
    If no data is created during the test, these lines equivilently do nothing.
    '''
    modulestore = xmodule.modulestore.django.modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo)
    modulestore.contentstore.drop_database()
    _CONTENTSTORE.clear()

    modulestore.collection.drop()
    xmodule.modulestore.django.clear_existing_modulestores()
コード例 #10
0
ファイル: django_utils.py プロジェクト: mitocw/edx-platform
def drop_mongo_collections(mock_create):
    """
    If using a Mongo-backed modulestore & contentstore, drop the collections.
    """
    # Do not create the modulestore if it does not exist.
    mock_create.return_value = None

    module_store = modulestore()
    if hasattr(module_store, '_drop_database'):
        module_store._drop_database(database=False)  # pylint: disable=protected-access
    _CONTENTSTORE.clear()
    if hasattr(module_store, 'close_connections'):
        module_store.close_connections()
コード例 #11
0
def drop_mongo_collections(mock_create):
    """
    If using a Mongo-backed modulestore & contentstore, drop the collections.
    """
    # Do not create the modulestore if it does not exist.
    mock_create.return_value = None

    module_store = modulestore()
    if hasattr(module_store, '_drop_database'):
        module_store._drop_database(database=False)  # pylint: disable=protected-access
    _CONTENTSTORE.clear()
    if hasattr(module_store, 'close_connections'):
        module_store.close_connections()
コード例 #12
0
ファイル: browser.py プロジェクト: nealmcb/edx-platform
def reset_databases(scenario):
    """
    After each scenario, all databases are cleared/dropped.  Contentstore data are stored in unique databases
    whereas modulestore data is in unique collection names.  This data is created implicitly during the scenarios.
    If no data is created during the test, these lines equivilently do nothing.
    """
    mongo = MongoClient()
    mongo.drop_database(settings.CONTENTSTORE["OPTIONS"]["db"])
    _CONTENTSTORE.clear()

    modulestore = xmodule.modulestore.django.editable_modulestore()
    modulestore.collection.drop()
    xmodule.modulestore.django.clear_existing_modulestores()
コード例 #13
0
    def drop_mongo_collections():
        """
        If using a Mongo-backed modulestore & contentstore, drop the collections.
        """
        module_store = modulestore()
        if hasattr(module_store, '_drop_database'):
            module_store._drop_database()  # pylint: disable=protected-access
        _CONTENTSTORE.clear()

        location_mapper = loc_mapper()
        if location_mapper.db:
            location_mapper.location_map.drop()
            location_mapper.db.connection.close()
コード例 #14
0
 def tearDown(self):
     shutil.rmtree(self.content_dir)
     MongoClient().drop_database(TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'])
     _CONTENTSTORE.clear()
コード例 #15
0
ファイル: test.py プロジェクト: OmarIthawi/edraak
    def tearDown(self):

        MongoClient().drop_database(TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'])
        _CONTENTSTORE.clear()
コード例 #16
0
 def tearDown(self):
     shutil.rmtree(self.content_dir)
     modulestore().contentstore.drop_database()
     _CONTENTSTORE.clear()
コード例 #17
0
 def tearDown(self):
     self.clear_subs_content()
     contentstore().drop_database()
     _CONTENTSTORE.clear()
コード例 #18
0
 def tearDown(self):
     MongoClient().drop_database(
         TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'])
     _CONTENTSTORE.clear()
コード例 #19
0
 def tearDown(self):
     modulestore().contentstore.drop_database()
     _CONTENTSTORE.clear()
コード例 #20
0
 def tearDown(self):
     MongoClient().drop_database(TEST_DATA_CONTENTSTORE["OPTIONS"]["db"])
     _CONTENTSTORE.clear()
コード例 #21
0
 def tearDown(self):
     MongoClient().drop_database(TEST_DATA_CONTENTSTORE['OPTIONS']['db'])
     _CONTENTSTORE.clear()
コード例 #22
0
 def tearDown(self):
     modulestore()._drop_database()
     _CONTENTSTORE.clear()
コード例 #23
0
 def tearDown(self):
     MongoClient().drop_database(TEST_DATA_CONTENTSTORE['OPTIONS']['db'])
     _CONTENTSTORE.clear()