Skip to content

Commit c71544f

Browse files
committed
new url_from_operation_id
1 parent 741412e commit c71544f

File tree

1 file changed

+10
-0
lines changed
  • packages/pytest-simcore/src/pytest_simcore

1 file changed

+10
-0
lines changed

packages/pytest-simcore/src/pytest_simcore/fastapi.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
from typing import Any, TypeVar
66

77
import httpx
8+
from fastapi import FastAPI
89
from models_library.generics import Envelope
910
from pydantic import TypeAdapter
1011
from servicelib.aiohttp import status
1112
from servicelib.status_codes_utils import get_code_display_name, is_error
13+
from yarl import URL
1214

1315
T = TypeVar("T")
1416

@@ -82,3 +84,11 @@ def _do_assert_error(
8284
assert expected_error_code in codes
8385

8486
return data, error
87+
88+
89+
def url_from_operation_id(
90+
client: httpx.AsyncClient, app: FastAPI, operation_id: str, **path_params
91+
) -> URL:
92+
return URL(f"{client.base_url}").with_path(
93+
app.url_path_for(operation_id, **path_params)
94+
)

0 commit comments

Comments
 (0)