Skip to content

Commit 99e37bd

Browse files
committed
fixes tests
1 parent 8315bf3 commit 99e37bd

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

services/web/server/src/simcore_service_webserver/projects/_common/exceptions_handlers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import logging
22

33
from servicelib.aiohttp import status
4-
from servicelib.rabbitmq.rpc_interfaces.catalog.errors import CatalogForbiddenError
4+
from servicelib.rabbitmq.rpc_interfaces.catalog.errors import (
5+
CatalogForbiddenError,
6+
CatalogItemNotFoundError,
7+
)
58

69
from ...exception_handling import (
710
ExceptionToHttpErrorMap,
@@ -166,6 +169,9 @@
166169
status.HTTP_403_FORBIDDEN,
167170
"Catalog forbidden: Insufficient access rights for {name}",
168171
),
172+
CatalogItemNotFoundError: HttpErrorInfo(
173+
status.HTTP_404_NOT_FOUND, "{name} was not found"
174+
),
169175
}
170176

171177
_TO_HTTP_ERROR_MAP: ExceptionToHttpErrorMap = {}

services/web/server/tests/unit/with_dbs/02/test_projects_nodes_handlers__patch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ async def test_patch_project_node_service_key_with_error(
356356
):
357357
node_id = next(iter(user_project["workbench"]))
358358
assert client.app
359-
base_url = client.app.router["patch_project_node"].url_for(
359+
url = client.app.router["patch_project_node"].url_for(
360360
project_id=user_project["uuid"], node_id=node_id
361361
)
362362
_patch_version = {"version": "2.0.9"}
@@ -365,12 +365,12 @@ async def test_patch_project_node_service_key_with_error(
365365
"simcore_service_webserver.projects.projects_service.catalog_rpc.check_for_service",
366366
side_effect=CatalogForbiddenError(name="test"),
367367
):
368-
resp = await client.patch(f"{base_url}", json=_patch_version)
368+
resp = await client.patch(f"{url}", json=_patch_version)
369369
assert resp.status == status.HTTP_403_FORBIDDEN
370370

371371
with mocker.patch(
372372
"simcore_service_webserver.projects.projects_service.catalog_rpc.check_for_service",
373373
side_effect=CatalogItemNotFoundError(name="test"),
374374
):
375-
resp = await client.patch(f"{base_url}", json=_patch_version)
375+
resp = await client.patch(f"{url}", json=_patch_version)
376376
assert resp.status == status.HTTP_404_NOT_FOUND

0 commit comments

Comments
 (0)