Skip to content

Commit 32312fb

Browse files
author
Andrei Neagu
committed
upgraded tests
1 parent 5b96536 commit 32312fb

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

packages/models-library/tests/test_service_settings_labels.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ def test_simcore_service_labels(example: dict, items: int, uses_dynamic_sidecar:
7878

7979
def test_service_settings():
8080
simcore_settings_settings_label = SimcoreServiceSettingsLabel.model_validate(
81-
SimcoreServiceSettingLabelEntry.model_config["json_schema_extra"]["examples"]
81+
SimcoreServiceSettingLabelEntry.model_json_schema()["examples"]
8282
)
8383
assert simcore_settings_settings_label
8484
assert len(simcore_settings_settings_label) == len(
85-
SimcoreServiceSettingLabelEntry.model_config["json_schema_extra"]["examples"]
85+
SimcoreServiceSettingLabelEntry.model_json_schema()["examples"]
8686
)
8787
assert simcore_settings_settings_label[0]
8888

@@ -122,16 +122,14 @@ def test_raises_error_if_http_entrypoint_is_missing():
122122

123123

124124
def test_path_mappings_none_state_paths():
125-
sample_data = deepcopy(
126-
PathMappingsLabel.model_config["json_schema_extra"]["examples"][0]
127-
)
125+
sample_data = deepcopy(PathMappingsLabel.model_json_schema()["examples"][0])
128126
sample_data["state_paths"] = None
129127
with pytest.raises(ValidationError):
130128
PathMappingsLabel(**sample_data)
131129

132130

133131
def test_path_mappings_json_encoding():
134-
for example in PathMappingsLabel.model_config["json_schema_extra"]["examples"]:
132+
for example in PathMappingsLabel.model_json_schema()["examples"]:
135133
path_mappings = PathMappingsLabel.model_validate(example)
136134
print(path_mappings)
137135
assert (
@@ -607,7 +605,7 @@ def test_resolving_some_service_labels_at_load_time(
607605
def test_user_preferences_path_is_part_of_exiting_volume():
608606
labels_data = {
609607
"simcore.service.paths-mapping": json.dumps(
610-
PathMappingsLabel.model_config["json_schema_extra"]["examples"][0]
608+
PathMappingsLabel.model_json_schema()["examples"][0]
611609
),
612610
"simcore.service.user-preferences-path": json.dumps(
613611
"/tmp/outputs" # noqa: S108

packages/service-integration/tests/test_osparc_config.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ def test_load_from_labels(
6262
)
6363
with open(config_path, "w") as fh:
6464
data = json.loads(
65-
model.model_dump_json(exclude_unset=True, by_alias=True, exclude_none=True)
65+
model.model_dump_json(
66+
exclude_unset=True, by_alias=True, exclude_none=True
67+
)
6668
)
6769
yaml.safe_dump(data, fh, sort_keys=False)
6870

@@ -73,10 +75,10 @@ def test_load_from_labels(
7375

7476
@pytest.mark.parametrize(
7577
"example_data",
76-
SimcoreServiceSettingLabelEntry.model_config["json_schema_extra"]["examples"],
78+
SimcoreServiceSettingLabelEntry.model_json_schema()["examples"],
7779
)
7880
def test_settings_item_in_sync_with_service_settings_label(
79-
example_data: dict[str, Any]
81+
example_data: dict[str, Any],
8082
):
8183
print(pformat(example_data))
8284

0 commit comments

Comments
 (0)