1919from scim2_tester .utils import CheckContext
2020
2121if TYPE_CHECKING :
22- from scim2_tester . utils import ResourceManager
22+ pass
2323
2424
2525def model_from_ref_type (
@@ -47,7 +47,6 @@ def model_from_ref_type_(ref_type: type) -> Any:
4747def generate_random_value (
4848 context : CheckContext ,
4949 obj : Resource [Any ],
50- resource_manager : "ResourceManager" ,
5150 field_name : str ,
5251) -> Any :
5352 field_type = obj .get_field_root_type (field_name )
@@ -82,7 +81,7 @@ def generate_random_value(
8281 ref_type = get_args (field_type )[0 ]
8382 if ref_type not in (ExternalReference , URIReference ):
8483 model = model_from_ref_type (context , ref_type , different_than = obj .__class__ )
85- ref_obj = resource_manager .create_and_register (model )
84+ ref_obj = context . resource_manager .create_and_register (model )
8685 value = ref_obj .meta .location
8786
8887 else :
@@ -92,10 +91,10 @@ def generate_random_value(
9291 value = random .choice (list (field_type ))
9392
9493 elif isclass (field_type ) and issubclass (field_type , ComplexAttribute ):
95- value = fill_with_random_values (context , field_type (), resource_manager )
94+ value = fill_with_random_values (context , field_type ())
9695
9796 elif isclass (field_type ) and issubclass (field_type , Extension ):
98- value = fill_with_random_values (context , field_type (), resource_manager )
97+ value = fill_with_random_values (context , field_type ())
9998
10099 else :
101100 # Put emails so this will be accepted by EmailStr too
@@ -106,14 +105,12 @@ def generate_random_value(
106105def fill_with_random_values (
107106 context : CheckContext ,
108107 obj : Resource [Any ],
109- resource_manager : "ResourceManager" ,
110108 field_names : list [str ] | None = None ,
111109) -> Resource [Any ] | None :
112110 """Fill an object with random values generated according the attribute types.
113111
114112 :param context: The check context containing the SCIM client and configuration
115113 :param obj: The Resource object to fill with random values
116- :param resource_manager: Resource manager for automatic cleanup
117114 :param field_names: Optional list of field names to fill (defaults to all)
118115 :returns: The filled object or None if the object ends up empty
119116 """
@@ -127,7 +124,7 @@ def fill_with_random_values(
127124 if field .default :
128125 continue
129126
130- value = generate_random_value (context , obj , resource_manager , field_name )
127+ value = generate_random_value (context , obj , field_name )
131128
132129 is_multiple = obj .get_field_multiplicity (field_name )
133130 if is_multiple :
0 commit comments