Skip to content

Commit 78f9508

Browse files
committed
improve test
1 parent fd54722 commit 78f9508

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

services/web/server/tests/integration/01/test_computation.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
from aiohttp.test_utils import TestClient
1919
from common_library.json_serialization import json_dumps
2020
from faker import Faker
21+
from models_library.projects_nodes import Node
2122
from models_library.projects_state import RunningState
23+
from pydantic import TypeAdapter
2224
from pytest_mock import MockerFixture
2325
from pytest_simcore.helpers.assert_checks import assert_status
2426
from servicelib.aiohttp import status
@@ -609,12 +611,7 @@ async def test_running_computation_sends_progress_updates_via_socketio(
609611

610612
project_id = user_project["uuid"]
611613

612-
# url_open = client.app.router["open_project"].url_for(
613-
# project_id=user_project["uuid"]
614-
# )
615-
# resp = await client.post(f"{url_open}", json=client_id)
616-
# await assert_status(resp, status.HTTP_200_OK)
617-
614+
# NOTE: no need to open the project, since the messages are sent to the user groups
618615
url_start = client.app.router["start_computation"].url_for(project_id=project_id)
619616
assert url_start == URL(f"/{API_VTAG}/computations/{project_id}:start")
620617

@@ -663,18 +660,13 @@ async def test_running_computation_sends_progress_updates_via_socketio(
663660
f"but got {len(call_args[0])} arguments"
664661
)
665662
message = call_args[0][0]
666-
assert isinstance(
667-
message, dict
668-
), f"expected message to be dict, got {type(message)}"
669-
assert (
670-
"node_id" in message
671-
), f"expected 'node_id' in message, got {message.keys()}"
672-
assert (
673-
"project_id" in message
674-
), f"expected 'project_id' in message, got {message.keys()}"
675-
assert (
676-
message["project_id"] == project_id
677-
), f"expected project_id to match {project_id}, got {message['project_id']}"
663+
assert "node_id" in message
664+
assert "project_id" in message
665+
assert "data" in message
666+
assert "errors" in message
667+
node_data = TypeAdapter(Node).validate_python(message["data"])
668+
assert node_data
669+
678670
received_progress_node_ids.add(message["node_id"])
679671

680672
# Verify that progress updates were sent for ALL computational nodes

0 commit comments

Comments
 (0)