Esempio n. 1
0
def client(loop, aiohttp_client, app_cfg, postgres_db, qx_client_outdir,
           mocks_on_projects_api):
    cfg = deepcopy(app_cfg)

    cfg["projects"]["enabled"] = True
    cfg["storage"]["enabled"] = False
    cfg["rabbit"]["enabled"] = False
    cfg["main"]["client_outdir"] = qx_client_outdir

    app = create_safe_application(cfg)

    setup_settings(app)
    setup_statics(app)
    setup_db(app)
    setup_session(app)
    setup_security(app)
    setup_rest(app)  # TODO: why should we need this??
    setup_login(app)
    setup_users(app)
    setup_products(app)
    assert setup_projects(app), "Shall not skip this setup"
    assert setup_studies_access(app), "Shall not skip this setup"

    # server and client
    yield loop.run_until_complete(
        aiohttp_client(
            app,
            server_kwargs={
                "port": cfg["main"]["port"],
                "host": cfg["main"]["host"]
            },
        ))
Esempio n. 2
0
def client(
    event_loop,
    aiohttp_client,
    app_cfg,
    postgres_db,
    mocked_director_v2_api,
    mock_orphaned_services,
    redis_client,
    monkeypatch_setenv_from_app_config: Callable,
):

    # config app
    cfg = deepcopy(app_cfg)
    port = cfg["main"]["port"]
    cfg["projects"]["enabled"] = True
    cfg["director"]["enabled"] = True
    cfg["resource_manager"][
        "garbage_collection_interval_seconds"
    ] = DEFAULT_GARBAGE_COLLECTOR_INTERVAL_SECONDS  # increase speed of garbage collection
    cfg["resource_manager"][
        "resource_deletion_timeout_seconds"
    ] = DEFAULT_GARBAGE_COLLECTOR_DELETION_TIMEOUT_SECONDS  # reduce deletion delay

    monkeypatch_setenv_from_app_config(cfg)
    app = create_safe_application(cfg)

    # setup app

    assert setup_settings(app)
    setup_db(app)
    setup_session(app)
    setup_security(app)
    setup_rest(app)
    setup_login(app)  # needed for login_utils fixtures
    setup_resource_manager(app)
    setup_garbage_collector(app)
    setup_socketio(app)
    setup_director(app)
    setup_director_v2(app)
    setup_tags(app)
    assert setup_projects(app)
    setup_products(app)

    # server and client
    yield event_loop.run_until_complete(
        aiohttp_client(app, server_kwargs={"port": port, "host": "localhost"})
    )
def client(
    loop,
    mock_orphaned_services,
    aiohttp_client,
    app_config,  # waits until swarm with *_services are up
    monkeypatch_setenv_from_app_config: Callable,
):
    assert app_config["rest"]["version"] == API_VERSION

    app_config["main"]["testing"] = True

    app_config["storage"]["enabled"] = False
    app_config["computation"]["enabled"] = False

    monkeypatch_setenv_from_app_config(app_config)
    app = create_safe_application(app_config)

    assert setup_settings(app)

    setup_db(app)
    setup_session(app)
    setup_security(app)
    setup_rest(app)
    setup_login(app)
    setup_resource_manager(app)
    setup_garbage_collector(app)
    assert setup_projects(app)
    setup_catalog(app)
    setup_products(app)
    setup_director_v2(app)

    yield loop.run_until_complete(
        aiohttp_client(
            app,
            server_kwargs={
                "port": app_config["main"]["port"],
                "host": app_config["main"]["host"],
            },
        )
    )
Esempio n. 4
0
def client(
    loop,
    mock_orphaned_services,
    aiohttp_client,
    app_config,  # waits until swarm with *_services are up
):
    assert app_config["rest"]["version"] == API_VERSION

    app_config["main"]["testing"] = True

    app_config["storage"]["enabled"] = False
    app_config["rabbit"]["enabled"] = False

    pprint(app_config)

    app = create_safe_application(app_config)

    setup_db(app)
    setup_session(app)
    setup_security(app)
    setup_rest(app)
    setup_login(app)
    setup_resource_manager(app)
    assert setup_projects(app)
    setup_catalog(app)
    setup_products(app)

    yield loop.run_until_complete(
        aiohttp_client(
            app,
            server_kwargs={
                "port": app_config["main"]["port"],
                "host": app_config["main"]["host"],
            },
        )
    )