Skip to content

Commit 43b018e

Browse files
committed
fix openapi test
1 parent 686c9f1 commit 43b018e

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

api/specs/web-server/_long_running_tasks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
description="Lists all long running tasks",
3737
responses=_data_export_responses,
3838
)
39-
def list_tasks(): ...
39+
def get_async_jobs(): ...
4040

4141

4242
@router.get(
@@ -46,7 +46,7 @@ def list_tasks(): ...
4646
description="Retrieves the status of a task",
4747
responses=_data_export_responses,
4848
)
49-
def get_task_status(
49+
def get_async_job_status(
5050
_path_params: Annotated[_PathParam, Depends()],
5151
): ...
5252

@@ -58,7 +58,7 @@ def get_task_status(
5858
responses=_data_export_responses,
5959
status_code=status.HTTP_204_NO_CONTENT,
6060
)
61-
def cancel_and_delete_task(
61+
def abort_async_job(
6262
_path_params: Annotated[_PathParam, Depends()],
6363
): ...
6464

@@ -69,6 +69,6 @@ def cancel_and_delete_task(
6969
description="Retrieves the result of a task",
7070
responses=_data_export_responses,
7171
)
72-
def get_task_result(
72+
def get_async_job_result(
7373
_path_params: Annotated[_PathParam, Depends()],
7474
): ...

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2980,7 +2980,7 @@ paths:
29802980
- long-running-tasks
29812981
summary: List Tasks
29822982
description: Lists all long running tasks
2983-
operationId: list_tasks
2983+
operationId: get_async_jobs
29842984
responses:
29852985
'200':
29862986
description: Successful Response
@@ -3018,7 +3018,7 @@ paths:
30183018
- long-running-tasks
30193019
summary: Get Task Status
30203020
description: Retrieves the status of a task
3021-
operationId: get_task_status
3021+
operationId: get_async_job_status
30223022
parameters:
30233023
- name: task_id
30243024
in: path
@@ -3062,7 +3062,7 @@ paths:
30623062
- long-running-tasks
30633063
summary: Cancel And Delete Task
30643064
description: Cancels and deletes a task
3065-
operationId: cancel_and_delete_task
3065+
operationId: abort_async_job
30663066
parameters:
30673067
- name: task_id
30683068
in: path
@@ -3103,7 +3103,7 @@ paths:
31033103
- long-running-tasks
31043104
summary: Get Task Result
31053105
description: Retrieves the result of a task
3106-
operationId: get_task_result
3106+
operationId: get_async_job_result
31073107
parameters:
31083108
- name: task_id
31093109
in: path

services/web/server/src/simcore_service_webserver/tasks/_rest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class _StorageAsyncJobId(BaseModel):
107107

108108

109109
@routes.get(
110-
_task_prefix + "/{task_id}/status",
110+
_task_prefix + "/{task_id}",
111111
name="get_async_job_status",
112112
)
113113
@login_required

services/web/server/tests/unit/with_dbs/01/storage/test_storage_rpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ async def test_get_async_jobs_status(
157157
backend_result_or_exception,
158158
)
159159

160-
response = await client.get(f"/{API_VERSION}/tasks/{_job_id}/status")
160+
response = await client.get(f"/{API_VERSION}/tasks/{_job_id}")
161161
assert response.status == expected_status
162162
if response.status == status.HTTP_200_OK:
163163
response_body_data = (

services/web/server/tests/unit/with_dbs/03/test__openapi_specs.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
1414
from pytest_simcore.helpers.typing_env import EnvVarsDict
1515
from pytest_simcore.openapi_specs import Entrypoint
16+
from simcore_service_webserver._meta import API_VTAG
1617
from simcore_service_webserver.application import create_application
1718
from simcore_service_webserver.application_settings import get_application_settings
1819
from simcore_service_webserver.rest._utils import get_openapi_specs_path
@@ -75,7 +76,13 @@ def test_app_named_resources_against_openapi_specs(
7576
openapi_specs_entrypoints: set[Entrypoint],
7677
app_rest_entrypoints: set[Entrypoint],
7778
):
78-
assert app_rest_entrypoints == openapi_specs_entrypoints
79+
# remove task-legacy routes. These should not be exposed.
80+
required_entry_points = {
81+
e
82+
for e in app_rest_entrypoints
83+
if not e.path.startswith(f"/{API_VTAG}/tasks-legacy")
84+
}
85+
assert required_entry_points == openapi_specs_entrypoints
7986

8087
# NOTE: missing here is:
8188
# - input schemas (path, query and body)

0 commit comments

Comments
 (0)