def _create(self, docs): for doc in docs: if doc.get('remove_first'): clean_dbs(superdesk.app, force=True) user = get_resource_service('users').find_one(username=get_default_user()['username'], req=None) if not user: get_resource_service('users').post([get_default_user()]) prepopulate_data(doc.get('profile') + '.json', get_default_user())
def _create(self, docs): for doc in docs: if doc.get("remove_first"): clean_dbs(app, force=True) app.init_indexes() app.data.init_elastic(app) get_resource_service("users").stop_updating_stage_visibility() user = get_resource_service("users").find_one( username=get_default_user()["username"], req=None) if not user: get_resource_service("users").post([get_default_user()]) prepopulate_data(doc.get("profile") + ".json", get_default_user()) get_resource_service("users").start_updating_stage_visibility() get_resource_service("users").update_stage_visibility_for_users()
def teardown_app(app): """ Drop test db and test app """ clean_dbs(app) del app