@@ -32,16 +32,20 @@ def _resource_types_endpoint(context: CheckContext) -> list[CheckResult]:
3232 "Service providers MUST provide this endpoint."
3333
3434 """
35- resource_types_result = query_all_resource_types (context )
36- results = [resource_types_result ]
35+ results = []
36+ resource_types_result_list = query_all_resource_types (context )
37+ results .extend (resource_types_result_list )
38+ resource_types_result = resource_types_result_list [
39+ 0
40+ ] # Get the first (and only) result
3741
3842 if resource_types_result .status == Status .SUCCESS :
3943 for resource_type in resource_types_result .data :
40- results .append (query_resource_type_by_id (context , resource_type ))
44+ results .extend (query_resource_type_by_id (context , resource_type ))
4145
4246 results .extend (resource_types_schema_validation (context ))
4347
44- results .append (access_invalid_resource_type (context ))
48+ results .extend (access_invalid_resource_type (context ))
4549
4650 return results
4751
@@ -122,7 +126,7 @@ def resource_types_schema_validation(
122126
123127
124128@checker ("discovery" , "resource-types" )
125- def query_all_resource_types (context : CheckContext ) -> CheckResult :
129+ def query_all_resource_types (context : CheckContext ) -> list [ CheckResult ] :
126130 """Validate retrieval of all available resource types.
127131
128132 Tests that the ``/ResourceTypes`` endpoint returns a list of all supported
@@ -143,13 +147,13 @@ def query_all_resource_types(context: CheckContext) -> CheckResult:
143147 )
144148 available = ", " .join ([f"'{ resource .name } '" for resource in response .resources ])
145149 reason = f"Resource types available are: { available } "
146- return CheckResult (status = Status .SUCCESS , reason = reason , data = response .resources )
150+ return [ CheckResult (status = Status .SUCCESS , reason = reason , data = response .resources )]
147151
148152
149153@checker ("discovery" , "resource-types" )
150154def query_resource_type_by_id (
151155 context : CheckContext , resource_type : ResourceType
152- ) -> CheckResult :
156+ ) -> list [ CheckResult ] :
153157 """Validate individual ResourceType retrieval by ID.
154158
155159 Tests that specific resource types can be retrieved using GET requests
@@ -171,11 +175,11 @@ def query_resource_type_by_id(
171175 expected_status_codes = context .conf .expected_status_codes or [200 ],
172176 )
173177 reason = f"Successfully accessed the /ResourceTypes/{ resource_type .id } endpoint."
174- return CheckResult (status = Status .SUCCESS , reason = reason , data = response )
178+ return [ CheckResult (status = Status .SUCCESS , reason = reason , data = response )]
175179
176180
177181@checker ("discovery" , "resource-types" )
178- def access_invalid_resource_type (context : CheckContext ) -> CheckResult :
182+ def access_invalid_resource_type (context : CheckContext ) -> list [ CheckResult ] :
179183 """Validate error handling for non-existent resource type IDs.
180184
181185 Tests that accessing ``/ResourceTypes/{invalid_id}`` with a non-existent resource
@@ -199,21 +203,27 @@ def access_invalid_resource_type(context: CheckContext) -> CheckResult:
199203 )
200204
201205 if not isinstance (response , Error ):
202- return CheckResult (
203- status = Status .ERROR ,
204- reason = f"/resource_types/{ probably_invalid_id } invalid URL did not return an Error object" ,
205- data = response ,
206- )
206+ return [
207+ CheckResult (
208+ status = Status .ERROR ,
209+ reason = f"/resource_types/{ probably_invalid_id } invalid URL did not return an Error object" ,
210+ data = response ,
211+ )
212+ ]
207213
208214 if response .status != 404 :
209- return CheckResult (
210- status = Status .ERROR ,
211- reason = f"/resource_types/{ probably_invalid_id } invalid URL did return an object, but the status code is { response .status } " ,
215+ return [
216+ CheckResult (
217+ status = Status .ERROR ,
218+ reason = f"/resource_types/{ probably_invalid_id } invalid URL did return an object, but the status code is { response .status } " ,
219+ data = response ,
220+ )
221+ ]
222+
223+ return [
224+ CheckResult (
225+ status = Status .SUCCESS ,
226+ reason = f"/resource_types/{ probably_invalid_id } invalid URL correctly returned a 404 error" ,
212227 data = response ,
213228 )
214-
215- return CheckResult (
216- status = Status .SUCCESS ,
217- reason = f"/resource_types/{ probably_invalid_id } invalid URL correctly returned a 404 error" ,
218- data = response ,
219- )
229+ ]
0 commit comments