Ejemplo n.º 1
0
def test_post_run_id_cancel(tmpdir: LocalPath) -> None:
    app: Flask = create_app(Path(tmpdir))
    app.testing = True
    client: FlaskClient[Response] = app.test_client()
    from .post_runs_tests.test_access_remote_files import access_remote_files
    posts_res: Response = access_remote_files(client)
    posts_res_data: RunId = posts_res.get_json()

    assert posts_res.status_code == 200

    run_id: str = posts_res_data["run_id"]
    sleep(3)
    posts_cancel_res: Response = post_run_id_cancel(client, run_id)
    posts_cancel_res_data: RunId = posts_cancel_res.get_json()

    assert posts_cancel_res.status_code == 200
    assert "run_id" in posts_cancel_res_data
    assert run_id == posts_cancel_res_data["run_id"]

    sleep(3)
    from .test_get_run_id_status import get_run_id_status
    res: Response = get_run_id_status(client, run_id)
    res_data: RunStatus = res.get_json()

    assert res.status_code == 200
    assert res_data["state"] == "CANCELED"  # type: ignore
Ejemplo n.º 2
0
def test_get_service_info(tmpdir: LocalPath) -> None:
    app: Flask = create_app(Path(tmpdir))
    app.testing = True
    client: FlaskClient[Response] = app.test_client()
    res: Response = client.get("/service-info")
    res_data: ServiceInfo = res.get_json()

    assert res.status_code == 200
    assert "workflow_type_versions" in res_data
    assert "supported_wes_versions" in res_data
    assert "supported_filesystem_protocols" in res_data
    assert "workflow_engine_versions" in res_data
    assert "default_workflow_engine_parameters" in res_data
    assert "system_state_counts" in res_data
    assert "auth_instructions_url" in res_data
    assert "contact_info_url" in res_data
    assert "tags" in res_data
Ejemplo n.º 3
0
def test_access_remote_files(tmpdir: LocalPath) -> None:
    app: Flask = create_app(Path(tmpdir))
    app.testing = True
    client: FlaskClient[Response] = app.test_client()
    posts_res: Response = access_remote_files(client)
    posts_res_data: RunId = posts_res.get_json()

    assert posts_res.status_code == 200
    assert "run_id" in posts_res_data

    run_id: str = posts_res_data["run_id"]
    sleep(3)
    from ..test_get_run_id import get_run_id
    res: Response = get_run_id(client, run_id)
    res_data: RunLog = res.get_json()

    assert res.status_code == 200
    assert "run_id" in res_data
    assert run_id == res_data["run_id"]
Ejemplo n.º 4
0
def test_get_runs(tmpdir: LocalPath) -> None:
    app: Flask = create_app(Path(tmpdir))
    app.testing = True
    client: FlaskClient[Response] = app.test_client()
    from .post_runs_tests.test_access_remote_files import access_remote_files
    posts_res: Response = access_remote_files(client)
    posts_res_data: RunId = posts_res.get_json()

    assert posts_res.status_code == 200

    run_id: str = posts_res_data["run_id"]
    sleep(3)
    res: Response = get_runs(client)
    res_data: RunListResponse = res.get_json()

    assert res.status_code == 200
    assert "runs" in res_data
    assert len(res_data["runs"]) == 1
    assert "run_id" in res_data["runs"][0]
    assert "state" in res_data["runs"][0]
    assert run_id == res_data["runs"][0]["run_id"]
Ejemplo n.º 5
0
def test_get_run_id(tmpdir: LocalPath) -> None:
    app: Flask = create_app(Path(tmpdir))
    app.testing = True
    client: FlaskClient[Response] = app.test_client()
    from .post_runs_tests.test_access_remote_files import access_remote_files
    posts_res: Response = access_remote_files(client)
    posts_res_data: RunId = posts_res.get_json()

    assert posts_res.status_code == 200

    run_id: str = posts_res_data["run_id"]
    sleep(3)
    res: Response = get_run_id(client, run_id)
    res_data: RunLog = res.get_json()

    assert res.status_code == 200
    assert "run_id" in res_data
    assert run_id == res_data["run_id"]
    assert "request" in res_data
    assert "workflow_params" in res_data["request"]
    assert "workflow_type" in res_data["request"]
    assert "workflow_type_version" in res_data["request"]
    assert "tags" in res_data["request"]
    assert "workflow_engine_parameters" in res_data["request"]
    assert "workflow_url" in res_data["request"]
    assert "state" in res_data
    assert "run_log" in res_data
    assert "name" in res_data["run_log"]
    assert "cmd" in res_data["run_log"]
    assert "start_time" in res_data["run_log"]
    assert "end_time" in res_data["run_log"]
    assert "stdout" in res_data["run_log"]
    assert "stderr" in res_data["run_log"]
    assert "exit_code" in res_data["run_log"]
    assert "task_logs" in res_data
    assert "outputs" in res_data