Skip to content

Commit e3510cd

Browse files
continue upgrading
1 parent 8e62f69 commit e3510cd

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

packages/models-library/tests/test_service_settings_labels.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_path_mappings_json_encoding():
126126
path_mappings = PathMappingsLabel.model_validate(example)
127127
print(path_mappings)
128128
assert (
129-
PathMappingsLabel.parse_raw(path_mappings.model_dump_json())
129+
PathMappingsLabel.model_validate_json(path_mappings.model_dump_json())
130130
== path_mappings
131131
)
132132

@@ -262,7 +262,7 @@ def test_container_outgoing_permit_list_and_container_allow_internet_with_compos
262262
"simcore.service.container-http-entrypoint": container_name_1,
263263
}
264264

265-
instance = DynamicSidecarServiceLabels.parse_raw(json.dumps(dict_data))
265+
instance = DynamicSidecarServiceLabels.model_validate_json(json.dumps(dict_data))
266266
assert (
267267
instance.containers_allowed_outgoing_permit_list[container_name_1][0]
268268
== expected_host_permit_list_policy
@@ -291,15 +291,15 @@ def test_container_outgoing_permit_list_and_container_allow_internet_without_com
291291
)
292292
},
293293
):
294-
assert DynamicSidecarServiceLabels.parse_raw(json.dumps(dict_data))
294+
assert TypeAdapter(DynamicSidecarServiceLabels).validate_json(json.dumps(dict_data))
295295

296296

297297
def test_container_allow_internet_no_compose_spec_not_ok():
298298
dict_data = {
299299
"simcore.service.containers-allowed-outgoing-internet": json.dumps(["hoho"]),
300300
}
301301
with pytest.raises(ValidationError) as exec_info:
302-
assert DynamicSidecarServiceLabels.parse_raw(json.dumps(dict_data))
302+
assert DynamicSidecarServiceLabels.model_validate_json(json.dumps(dict_data))
303303

304304
assert "Expected only 1 entry 'container' not '{'hoho'}" in f"{exec_info.value}"
305305

@@ -312,7 +312,7 @@ def test_container_allow_internet_compose_spec_not_ok():
312312
"simcore.service.containers-allowed-outgoing-internet": json.dumps(["hoho"]),
313313
}
314314
with pytest.raises(ValidationError) as exec_info:
315-
assert DynamicSidecarServiceLabels.parse_raw(json.dumps(dict_data))
315+
assert DynamicSidecarServiceLabels.model_validate_json(json.dumps(dict_data))
316316

317317
assert f"container='hoho' not found in {compose_spec=}" in f"{exec_info.value}"
318318

@@ -331,7 +331,7 @@ def test_container_outgoing_permit_list_no_compose_spec_not_ok():
331331
),
332332
}
333333
with pytest.raises(ValidationError) as exec_info:
334-
assert DynamicSidecarServiceLabels.parse_raw(json.dumps(dict_data))
334+
assert DynamicSidecarServiceLabels.model_validate_json(json.dumps(dict_data))
335335
assert (
336336
f"Expected only one entry '{DEFAULT_SINGLE_SERVICE_NAME}' not 'container_name'"
337337
in f"{exec_info.value}"
@@ -355,7 +355,7 @@ def test_container_outgoing_permit_list_compose_spec_not_ok():
355355
"simcore.service.compose-spec": json.dumps(compose_spec),
356356
}
357357
with pytest.raises(ValidationError) as exec_info:
358-
assert DynamicSidecarServiceLabels.parse_raw(json.dumps(dict_data))
358+
assert DynamicSidecarServiceLabels.model_validate_json(json.dumps(dict_data))
359359
assert (
360360
f"Trying to permit list container='container_name' which was not found in {compose_spec=}"
361361
in f"{exec_info.value}"
@@ -378,7 +378,7 @@ def test_not_allowed_in_both_permit_list_and_outgoing_internet():
378378
}
379379

380380
with pytest.raises(ValidationError) as exec_info:
381-
DynamicSidecarServiceLabels.parse_raw(json.dumps(dict_data))
381+
DynamicSidecarServiceLabels.model_validate_json(json.dumps(dict_data))
382382

383383
assert (
384384
f"Not allowed common_containers={{'{container_name}'}} detected"
@@ -610,4 +610,4 @@ def test_user_preferences_path_is_part_of_exiting_volume():
610610
),
611611
}
612612
with pytest.raises(ValidationError, match="user_preferences_path=/tmp/outputs"):
613-
assert DynamicSidecarServiceLabels.parse_raw(json.dumps(labels_data))
613+
assert DynamicSidecarServiceLabels.model_validate_json(json.dumps(labels_data))

packages/models-library/tests/test_user_preferences.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test__user_service__user_preference(
128128
# NOTE: these will be stored as bytes,
129129
# check bytes serialization/deserialization
130130
pref1_as_bytes = pref1.model_dump_json().encode()
131-
new_instance = UserServiceUserPreference.parse_raw(pref1_as_bytes)
131+
new_instance = UserServiceUserPreference.model_validate_json(pref1_as_bytes)
132132
assert new_instance == pref1
133133

134134

packages/settings-library/src/settings_library/utils_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def print_as_envfile(
6363

6464
def print_as_json(settings_obj, *, compact=False, **pydantic_export_options):
6565
typer.echo(
66-
settings_obj.json(indent=None if compact else 2, **pydantic_export_options)
66+
settings_obj.model_dump_json(indent=None if compact else 2, **pydantic_export_options)
6767
)
6868

6969

packages/settings-library/tests/test_utils_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def fake_granular_env_file_content() -> str:
8585
def export_as_dict() -> Callable:
8686
def _export(model_obj, **export_options):
8787
return json.loads(
88-
model_obj.json(
88+
model_obj.model_dump_json(
8989
encoder=create_json_encoder_wo_secrets(model_obj.__class__),
9090
**export_options,
9191
)
@@ -136,7 +136,7 @@ def test_settings_as_json(
136136

137137
# reuse resulting json to build settings
138138
settings: dict = json.loads(result.stdout)
139-
assert fake_settings_class.parse_obj(settings)
139+
assert fake_settings_class.model_validate(settings)
140140

141141

142142
def test_settings_as_json_schema(

packages/simcore-sdk/src/simcore_sdk/node_ports_common/r_clone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ async def _get_folder_size(
167167
cwd=f"{local_dir.resolve()}",
168168
)
169169

170-
rclone_folder_size_result = _RCloneSize.parse_raw(result)
170+
rclone_folder_size_result = _RCloneSize.model_validate_json(result)
171171
_logger.debug(
172172
"RClone size call for %s: %s", f"{folder}", f"{rclone_folder_size_result}"
173173
)

0 commit comments

Comments
 (0)