Skip to content

Commit ef6d08d

Browse files
fix tests
1 parent 1ebd385 commit ef6d08d

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

packages/pytest-simcore/src/pytest_simcore/services_api_mocks_for_aiohttp_clients.py

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
PresignedLink,
2424
)
2525
from models_library.generics import Envelope
26+
from models_library.projects_nodes import NodeID, NodeState
2627
from models_library.projects_pipeline import ComputationTask, PipelineDetails, TaskID
2728
from models_library.projects_state import RunningState
2829
from models_library.utils.fastapi_encoders import jsonable_encoder
@@ -89,29 +90,39 @@ def create_computation_cb(url, **kwargs) -> CallbackResult:
8990
pipeline = {}
9091
node_states = {}
9192
for node_id in body.get("subgraph"):
92-
pipeline[node_id] = [
93-
"62237c33-8d6c-4709-aa92-c3cf693dd6d2",
94-
"0bdf824f-57cb-4e38-949e-fd12c184f000",
93+
pipeline[NodeID(node_id)] = [
94+
NodeID("62237c33-8d6c-4709-aa92-c3cf693dd6d2"),
95+
NodeID("0bdf824f-57cb-4e38-949e-fd12c184f000"),
9596
]
96-
node_states[node_id] = {"state": {"modified": True, "dependencies": []}}
97-
node_states["62237c33-8d6c-4709-aa92-c3cf693dd6d2"] = {
98-
"modified": True,
99-
"dependencies": ["2f493631-30b4-4ad8-90f2-a74e4b46fe73"],
100-
}
101-
node_states["0bdf824f-57cb-4e38-949e-fd12c184f000"] = {
102-
"modified": True,
103-
"dependencies": [
104-
"2f493631-30b4-4ad8-90f2-a74e4b46fe73",
105-
"62237c33-8d6c-4709-aa92-c3cf693dd6d2",
106-
],
107-
}
97+
node_states[NodeID(node_id)] = NodeState.model_construct(
98+
**{"state": {"modified": True, "dependencies": []}}
99+
)
100+
node_states[
101+
NodeID("62237c33-8d6c-4709-aa92-c3cf693dd6d2")
102+
] = NodeState.model_construct(
103+
**{
104+
"modified": True,
105+
"dependencies": {NodeID("2f493631-30b4-4ad8-90f2-a74e4b46fe73")},
106+
}
107+
)
108+
node_states[
109+
NodeID("0bdf824f-57cb-4e38-949e-fd12c184f000")
110+
] = NodeState.model_construct(
111+
**{
112+
"modified": True,
113+
"dependencies": {
114+
NodeID("2f493631-30b4-4ad8-90f2-a74e4b46fe73"),
115+
NodeID("62237c33-8d6c-4709-aa92-c3cf693dd6d2"),
116+
},
117+
}
118+
)
108119
returned_computation = ComputationTask.model_validate(
109120
ComputationTask.model_config["json_schema_extra"]["examples"][0]
110121
).model_copy(
111122
update={
112123
"id": TaskID(f"{kwargs['json']['project_id']}"),
113124
"state": state,
114-
"pipeline_details": PipelineDetails(
125+
"pipeline_details": PipelineDetails.model_construct(
115126
**{
116127
"adjacency_list": pipeline,
117128
"node_states": node_states,
@@ -142,7 +153,7 @@ def get_computation_cb(url, **kwargs) -> CallbackResult:
142153
update={
143154
"id": TaskID(Path(url.path).name),
144155
"state": state,
145-
"pipeline_details": PipelineDetails(
156+
"pipeline_details": PipelineDetails.model_construct(
146157
**{
147158
"adjacency_list": pipeline,
148159
"node_states": node_states,

services/web/server/tests/unit/with_dbs/01/test_director_v2_handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ async def test_start_partial_computation(
5858
project_id: ProjectID,
5959
user_role: UserRole,
6060
expected: ExpectedResponse,
61+
faker: Faker,
6162
):
6263
assert client.app
6364

6465
url = client.app.router["start_computation"].url_for(project_id=f"{project_id}")
6566
rsp = await client.post(
66-
f"{url}", json={"subgraph": ["node_id1", "node_id2", "node_id498"]}
67+
f"{url}", json={"subgraph": [faker.uuid4(), faker.uuid4(), faker.uuid4()]}
6768
)
6869
data, error = await assert_status(
6970
rsp,

0 commit comments

Comments
 (0)