77from scim2_models import PatchOp
88from scim2_models import PatchOperation
99from scim2_models import Resource
10+ from scim2_models .path import Path
1011
1112from ..filling import generate_random_value
12- from ..urns import get_annotation_by_urn
13- from ..urns import get_value_by_urn
14- from ..urns import iter_all_urns
1513from ..utils import CheckContext
1614from ..utils import CheckResult
1715from ..utils import Status
@@ -59,16 +57,14 @@ def check_replace_attribute(
5957 ]
6058
6159 results = []
62- all_urns = list (
63- iter_all_urns (
64- model ,
60+ all_paths = list (
61+ Path [model ].iter_paths (
6562 mutability = [Mutability .read_write , Mutability .write_only ],
66- # Not supported until filters are implemented in scim2_models
6763 include_subattributes = False ,
6864 )
6965 )
7066
71- if not all_urns :
67+ if not all_paths :
7268 return [
7369 check_result (
7470 context ,
@@ -80,15 +76,16 @@ def check_replace_attribute(
8076
8177 base_resource = context .resource_manager .create_and_register (model )
8278
83- for urn , source_model in all_urns :
84- patch_value = generate_random_value (context , urn = urn , model = source_model )
85- mutability = get_annotation_by_urn (Mutability , urn , source_model )
79+ for path in all_paths :
80+ urn = str (path )
81+ patch_value = generate_random_value (context , path = path )
82+ mutability = path .get_annotation (Mutability )
8683
8784 patch_op = PatchOp [type (base_resource )](
8885 operations = [
8986 PatchOperation (
9087 op = PatchOperation .Op .replace_ ,
91- path = urn ,
88+ path = path ,
9289 value = patch_value ,
9390 )
9491 ]
@@ -117,7 +114,7 @@ def check_replace_attribute(
117114 continue
118115
119116 if modify_result is not None :
120- modify_actual_value = get_value_by_urn (modify_result , urn )
117+ modify_actual_value = path . get (modify_result )
121118 if mutability != Mutability .write_only and not fields_equality (
122119 patch_value , modify_actual_value
123120 ):
@@ -161,7 +158,7 @@ def check_replace_attribute(
161158 )
162159 continue
163160
164- actual_value = get_value_by_urn (updated_resource , urn )
161+ actual_value = path . get (updated_resource )
165162 if mutability == Mutability .write_only or fields_equality (
166163 patch_value , actual_value
167164 ):
0 commit comments