Skip to content

Commit 0c335b8

Browse files
committed
updates tests fixtures
1 parent 1af8194 commit 0c335b8

File tree

2 files changed

+16
-4
lines changed
  • services/web/server

2 files changed

+16
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
from .schemas import StorageFileIDStr
6262
from .settings import StorageSettings, get_plugin_settings
6363

64-
log = logging.getLogger(__name__)
64+
_logger = logging.getLogger(__name__)
6565

6666

6767
def _get_base_storage_url(app: web.Application) -> URL:
@@ -139,6 +139,7 @@ async def _forward_request_to_storage(
139139
async with session.request(
140140
method.upper(), url, ssl=False, json=body, **kwargs
141141
) as resp:
142+
_logger.debug("Forwarded request to storage %s %s: %s", method, url, resp)
142143
match resp.status:
143144
case status.HTTP_422_UNPROCESSABLE_ENTITY:
144145
raise web.HTTPUnprocessableEntity(

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# pylint: disable=unused-variable
44
# pylint: disable=too-many-arguments
55

6+
import contextlib
67
import logging
78
import random
89
from collections.abc import Iterator
@@ -47,8 +48,12 @@ def storage_vtag() -> str:
4748

4849
@pytest.fixture(scope="module")
4950
def fake_storage_app(storage_vtag: str) -> FastAPI: # noqa: C901
50-
app = FastAPI(debug=True)
51-
add_pagination(app)
51+
52+
@contextlib.asynccontextmanager
53+
async def _app_lifespan(app: FastAPI):
54+
logging.info("Starting fake storage app ...")
55+
yield
56+
logging.info("Stopping fake storage app ...")
5257

5358
router = APIRouter(
5459
prefix=f"/{storage_vtag}",
@@ -257,7 +262,13 @@ async def abort_upload_file(
257262
request: Request,
258263
): ...
259264

260-
app.include_router(router)
265+
app = FastAPI(
266+
debug=True,
267+
lifespan=_app_lifespan,
268+
routes=router.routes,
269+
title="Fake Storage",
270+
)
271+
add_pagination(app)
261272

262273
return app
263274

0 commit comments

Comments
 (0)