|
18 | 18 | from aiohttp.test_utils import TestClient |
19 | 19 | from common_library.json_serialization import json_dumps |
20 | 20 | from faker import Faker |
| 21 | +from models_library.projects_nodes import Node |
21 | 22 | from models_library.projects_state import RunningState |
| 23 | +from pydantic import TypeAdapter |
22 | 24 | from pytest_mock import MockerFixture |
23 | 25 | from pytest_simcore.helpers.assert_checks import assert_status |
24 | 26 | from servicelib.aiohttp import status |
@@ -609,12 +611,7 @@ async def test_running_computation_sends_progress_updates_via_socketio( |
609 | 611 |
|
610 | 612 | project_id = user_project["uuid"] |
611 | 613 |
|
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 |
618 | 615 | url_start = client.app.router["start_computation"].url_for(project_id=project_id) |
619 | 616 | assert url_start == URL(f"/{API_VTAG}/computations/{project_id}:start") |
620 | 617 |
|
@@ -663,18 +660,13 @@ async def test_running_computation_sends_progress_updates_via_socketio( |
663 | 660 | f"but got {len(call_args[0])} arguments" |
664 | 661 | ) |
665 | 662 | 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 | + |
678 | 670 | received_progress_node_ids.add(message["node_id"]) |
679 | 671 |
|
680 | 672 | # Verify that progress updates were sent for ALL computational nodes |
|
0 commit comments