1515from ..utils import CheckContext
1616from ..utils import CheckResult
1717from ..utils import Status
18+ from ..utils import check_result
1819from ..utils import checker
1920from ..utils import compare_field
2021
@@ -49,7 +50,8 @@ def check_replace_attribute(
4950 and not context .client .service_provider_config .patch .supported
5051 ):
5152 return [
52- CheckResult (
53+ check_result (
54+ context ,
5355 status = Status .SKIPPED ,
5456 reason = "PATCH operations not supported by server" ,
5557 resource_type = model .__name__ ,
@@ -68,7 +70,8 @@ def check_replace_attribute(
6870
6971 if not all_urns :
7072 return [
71- CheckResult (
73+ check_result (
74+ context ,
7275 status = Status .SKIPPED ,
7376 reason = f"No replaceable attributes found for { model .__name__ } " ,
7477 resource_type = model .__name__ ,
@@ -99,7 +102,8 @@ def check_replace_attribute(
99102 )
100103 except SCIMClientError as exc :
101104 results .append (
102- CheckResult (
105+ check_result (
106+ context ,
103107 status = Status .ERROR ,
104108 reason = f"Failed to replace attribute '{ urn } ': { exc } " ,
105109 resource_type = model .__name__ ,
@@ -119,7 +123,8 @@ def check_replace_attribute(
119123 or compare_field (patch_value , modify_actual_value )
120124 ):
121125 results .append (
122- CheckResult (
126+ check_result (
127+ context ,
123128 status = Status .ERROR ,
124129 reason = f"PATCH modify() returned incorrect value for '{ urn } '" ,
125130 resource_type = model .__name__ ,
@@ -139,7 +144,8 @@ def check_replace_attribute(
139144 )
140145 except SCIMClientError as exc :
141146 results .append (
142- CheckResult (
147+ check_result (
148+ context ,
143149 status = Status .ERROR ,
144150 reason = f"Failed to query resource after replace on '{ urn } ': { exc } " ,
145151 resource_type = model .__name__ ,
@@ -157,7 +163,8 @@ def check_replace_attribute(
157163 patch_value , actual_value
158164 ):
159165 results .append (
160- CheckResult (
166+ check_result (
167+ context ,
161168 status = Status .SUCCESS ,
162169 reason = f"Successfully replaced attribute '{ urn } '" ,
163170 resource_type = model .__name__ ,
@@ -169,7 +176,8 @@ def check_replace_attribute(
169176 )
170177 else :
171178 results .append (
172- CheckResult (
179+ check_result (
180+ context ,
173181 status = Status .ERROR ,
174182 reason = f"Attribute '{ urn } ' was not replaced or has incorrect value" ,
175183 resource_type = model .__name__ ,
0 commit comments