Skip to content

Commit 8ffa91b

Browse files
fix tests
1 parent f8fa9e6 commit 8ffa91b

File tree

3 files changed

+58
-45
lines changed

3 files changed

+58
-45
lines changed

services/web/server/src/simcore_service_webserver/projects/_controller/ports_rest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,17 @@ async def update_project_inputs(request: web.Request) -> web.Response:
113113
partial_workbench_data
114114
)
115115

116-
updated_workbench = await _nodes_service.update_project_nodes_map(
116+
await _nodes_service.update_project_nodes_map(
117117
request.app,
118118
project_id=path_params.project_id,
119119
partial_nodes_map=partial_nodes_map,
120120
)
121121

122+
# get updated workbench (including not updated nodes)
123+
updated_workbench = await _nodes_service.get_project_nodes_map(
124+
request.app, project_id=path_params.project_id
125+
)
126+
122127
await _create_project_document_and_notify(
123128
request.app,
124129
project_id=path_params.project_id,

services/web/server/src/simcore_service_webserver/projects/_nodes_repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async def update_project_nodes_map(
5656
project_node = await repo.update(
5757
conn,
5858
node_id=node_id,
59-
node=node,
59+
**node.model_dump(exclude_none=True, exclude_unset=True),
6060
)
6161
workbench[node_id] = project_node.model_dump_as_node()
6262

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

Lines changed: 51 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import pytest
1313
from aiohttp.test_utils import TestClient
1414
from aioresponses import aioresponses as AioResponsesMock # noqa: N812
15+
from deepdiff import DeepDiff
1516
from models_library.api_schemas_directorv2.computations import TasksOutputs
1617
from models_library.api_schemas_webserver.projects import ProjectGet
1718
from models_library.utils.fastapi_encoders import jsonable_encoder
@@ -109,55 +110,62 @@ async def test_io_workflow(
109110
ports_meta, error = await assert_status(resp, expected_status_code=expected)
110111

111112
if not error:
112-
assert ports_meta == [
113-
{
114-
"key": "38a0d401-af4b-4ea7-ab4c-5005c712a546",
115-
"kind": "input",
116-
"content_schema": {
117-
"description": "Input integer value",
118-
"title": "X",
119-
"type": "integer",
113+
diff = DeepDiff(
114+
ports_meta,
115+
[
116+
{
117+
"key": "38a0d401-af4b-4ea7-ab4c-5005c712a546",
118+
"kind": "input",
119+
"content_schema": {
120+
"description": "Input integer value",
121+
"title": "X",
122+
"type": "integer",
123+
},
120124
},
121-
},
122-
{
123-
"key": "fc48252a-9dbb-4e07-bf9a-7af65a18f612",
124-
"kind": "input",
125-
"content_schema": {
126-
"description": "Input integer value",
127-
"title": "Z",
128-
"type": "integer",
125+
{
126+
"key": "fc48252a-9dbb-4e07-bf9a-7af65a18f612",
127+
"kind": "input",
128+
"content_schema": {
129+
"description": "Input integer value",
130+
"title": "Z",
131+
"type": "integer",
132+
},
129133
},
130-
},
131-
{
132-
"key": "7bf0741f-bae4-410b-b662-fc34b47c27c9",
133-
"kind": "input",
134-
"content_schema": {
135-
"description": "Input boolean value",
136-
"title": "on",
137-
"type": "boolean",
134+
{
135+
"key": "7bf0741f-bae4-410b-b662-fc34b47c27c9",
136+
"kind": "input",
137+
"content_schema": {
138+
"description": "Input boolean value",
139+
"title": "on",
140+
"type": "boolean",
141+
},
138142
},
139-
},
140-
{
141-
"key": "09fd512e-0768-44ca-81fa-0cecab74ec1a",
142-
"kind": "output",
143-
"content_schema": {
144-
"description": "Output integer value",
145-
"title": "Random sleep interval_2",
146-
"type": "integer",
143+
{
144+
"key": "09fd512e-0768-44ca-81fa-0cecab74ec1a",
145+
"kind": "output",
146+
"content_schema": {
147+
"description": "Output integer value",
148+
"title": "Random sleep interval_2",
149+
"type": "integer",
150+
},
147151
},
148-
},
149-
{
150-
"key": "76f607b4-8761-4f96-824d-cab670bc45f5",
151-
"kind": "output",
152-
"content_schema": {
153-
"description": "Output integer value",
154-
"title": "Random sleep interval",
155-
"type": "integer",
152+
{
153+
"key": "76f607b4-8761-4f96-824d-cab670bc45f5",
154+
"kind": "output",
155+
"content_schema": {
156+
"description": "Output integer value",
157+
"title": "Random sleep interval",
158+
"type": "integer",
159+
},
156160
},
157-
},
158-
]
161+
],
162+
ignore_order=True,
163+
)
159164

160-
assert ports_meta == PROJECTS_METADATA_PORTS_RESPONSE_BODY_DATA
165+
assert not diff
166+
assert not DeepDiff(
167+
ports_meta, PROJECTS_METADATA_PORTS_RESPONSE_BODY_DATA, ignore_order=True
168+
)
161169

162170
# get_project_inputs
163171
expected_url = client.app.router["get_project_inputs"].url_for(

0 commit comments

Comments
 (0)