@patch('xmodule.modulestore.django.create_modulestore_instance', autospec=True)
def drop_mongo_collections(mock_create):
 mock_create.return_value = None
 module_store = modulestore()
 if hasattr(module_store, '_drop_database'):
  module_store._drop_database(database=False)
 _CONTENTSTORE.clear()
 if hasattr(module_store, 'close_connections'):
  module_store.close_connections()

@ patch ( 'xmodule.modulestore.django.create_modulestore_instance' , autospec = True ) def drop_mongo_collections ( mock_create ) : mock_create . return_value = None module_store = modulestore ( ) if hasattr ( module_store , '_drop_database' ) : module_store . _drop_database ( database = False ) _CONTENTSTORE . clear ( ) if hasattr ( module_store , 'close_connections' ) : module_store . close_connections ( )
if using a mongo-backed modulestore & contentstore .