@@ -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
297297def 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 ))
0 commit comments