def client( loop, app_cfg, aiohttp_client, postgres_db, monkeypatch_setenv_from_app_config: Callable, ): # fixture: minimal client with catalog-subsystem enabled and # only pertinent modules # # - Mocks calls to actual API monkeypatch_setenv_from_app_config(app_cfg) app = create_safe_application(app_cfg) assert setup_settings(app) # patch all setup_db(app) setup_session(app) setup_security(app) setup_rest(app) setup_login(app) # needed for login_utils fixtures assert setup_catalog(app) setup_products(app) yield loop.run_until_complete( aiohttp_client(app, server_kwargs={"port": app_cfg["main"]["port"]}))
def client( loop: asyncio.AbstractEventLoop, aiohttp_client: Callable, app_config: Dict, postgres_with_template_db: aiopg.sa.engine.Engine, mock_orphaned_services: mock.Mock, monkeypatch_setenv_from_app_config: Callable, ): # test config & env vars ---------------------- cfg = deepcopy(app_config) assert cfg["rest"]["version"] == API_VERSION assert cfg["rest"]["enabled"] cfg["projects"]["enabled"] = True cfg["director"]["enabled"] = True cfg["exporter"]["enabled"] = True monkeypatch_setenv_from_app_config(cfg) # app setup ---------------------------------- app = create_safe_application(cfg) # activates only security+restAPI sub-modules setup_settings(app) assert get_exporter_settings(app) is not None, "Should capture defaults" setup_db(app) setup_session(app) setup_security(app) setup_rest(app) setup_login(app) setup_users(app) setup_socketio(app) setup_projects(app) setup_director(app) setup_director_v2(app) setup_exporter(app) # <---- under test setup_storage(app) setup_products(app) setup_catalog(app) setup_scicrunch_submodule(app) assert setup_resource_manager(app) yield loop.run_until_complete( aiohttp_client( app, server_kwargs={ "port": cfg["main"]["port"], "host": cfg["main"]["host"] }, ))
def client(loop, aiohttp_client, app_config, postgres_with_template_db, mock_orphaned_services): cfg = deepcopy(app_config) assert cfg["rest"]["version"] == API_VERSION assert cfg["rest"]["enabled"] cfg["projects"]["enabled"] = True cfg["director"]["enabled"] = True # fake config app = create_safe_application(cfg) # activates only security+restAPI sub-modules setup_db(app) setup_session(app) setup_security(app) setup_rest(app) setup_login(app) setup_users(app) setup_socketio(app) setup_projects(app) setup_director(app) setup_director_v2(app) setup_exporter(app) setup_storage(app) setup_products(app) setup_catalog(app) setup_scicrunch_submodule(app) assert setup_resource_manager(app) yield loop.run_until_complete( aiohttp_client( app, server_kwargs={ "port": cfg["main"]["port"], "host": cfg["main"]["host"] }, ))
def client(loop, app_cfg, aiohttp_client, postgres_db): # fixture: minimal client with catalog-subsystem enabled and # only pertinent modules # # - Mocks calls to actual API cfg = deepcopy(app_cfg) cfg["db"][ "init_tables"] = True # inits tables of postgres_service upon startup cfg["catalog"]["enabled"] = True app = create_safe_application(app_cfg) # patch all setup_db(app) setup_session(app) setup_security(app) setup_rest(app) setup_login(app) # needed for login_utils fixtures assert setup_catalog(app) yield loop.run_until_complete( aiohttp_client(app, server_kwargs={"port": app_cfg["main"]["port"]}))