1010
1111
1212def resource_types_endpoint (context : CheckContext ) -> list [CheckResult ]:
13- """As described in RFC7644 §4 <rfc7644#section-4>`, `/ResourceTypes` is a mandatory endpoint, and should only be accessible by GET.
13+ """Orchestrate validation of the ResourceTypes discovery endpoint.
14+
15+ Runs comprehensive tests on the ``/ResourceTypes`` endpoint including listing
16+ all resource types, querying individual types by ID, and error handling for
17+ invalid requests.
18+
19+ **Status:**
20+
21+ - :attr:`~scim2_tester.Status.SUCCESS`: All sub-checks completed successfully
22+ - :attr:`~scim2_tester.Status.ERROR`: One or more sub-checks failed
23+
24+ .. pull-quote:: :rfc:`RFC 7644 Section 4 - Discovery <7644#section-4>`
25+
26+ "An HTTP GET to this endpoint is used to discover the types of resources
27+ available on a SCIM service provider (e.g., Users and Groups)."
28+
29+ "Service providers MUST provide this endpoint."
1430
1531 .. todo::
1632
1733 - Check POST/PUT/PATCH/DELETE on the endpoint
1834 - Check that query parameters are ignored
19- - Check that query parameters are ignored
2035 - Check that a 403 response is returned if a filter is passed
2136 - Check that the `schema` attribute exists and is available.
2237 """
@@ -34,6 +49,21 @@ def resource_types_endpoint(context: CheckContext) -> list[CheckResult]:
3449
3550@checker ("discovery" , "resource-types" )
3651def query_all_resource_types (context : CheckContext ) -> CheckResult :
52+ """Validate retrieval of all available resource types.
53+
54+ Tests that the ``/ResourceTypes`` endpoint returns a list of all supported
55+ resource types with their metadata, schemas, and endpoint information.
56+
57+ **Status:**
58+
59+ - :attr:`~scim2_tester.Status.SUCCESS`: Endpoint returns valid list of :class:`~scim2_models.ResourceType` objects
60+ - :attr:`~scim2_tester.Status.ERROR`: Endpoint is inaccessible or returns invalid response
61+
62+ .. pull-quote:: :rfc:`RFC 7644 Section 4 - Discovery <7644#section-4>`
63+
64+ "An HTTP GET to this endpoint is used to discover the types of resources
65+ available on a SCIM service provider (e.g., Users and Groups)."
66+ """
3767 response = context .client .query (
3868 ResourceType , expected_status_codes = context .conf .expected_status_codes or [200 ]
3969 )
@@ -46,6 +76,21 @@ def query_all_resource_types(context: CheckContext) -> CheckResult:
4676def query_resource_type_by_id (
4777 context : CheckContext , resource_type : ResourceType
4878) -> CheckResult :
79+ """Validate individual ResourceType retrieval by ID.
80+
81+ Tests that specific resource types can be retrieved using GET requests
82+ to ``/ResourceTypes/{id}`` with their complete metadata and configuration.
83+
84+ **Status:**
85+
86+ - :attr:`~scim2_tester.Status.SUCCESS`: :class:`~scim2_models.ResourceType` retrieved successfully with valid data
87+ - :attr:`~scim2_tester.Status.ERROR`: Failed to retrieve or received invalid response
88+
89+ .. pull-quote:: :rfc:`RFC 7644 Section 4 - Discovery <7644#section-4>`
90+
91+ "Each resource type defines the endpoint, the core schema URI that defines
92+ the resource, and any supported schema extensions."
93+ """
4994 response = context .client .query (
5095 ResourceType ,
5196 resource_type .id ,
@@ -60,6 +105,20 @@ def query_resource_type_by_id(
60105
61106@checker ("discovery" , "resource-types" )
62107def access_invalid_resource_type (context : CheckContext ) -> CheckResult :
108+ """Validate error handling for non-existent resource type IDs.
109+
110+ Tests that accessing ``/ResourceTypes/{invalid_id}`` with a non-existent resource
111+ type ID returns appropriate :class:`~scim2_models.Error` object with 404 status.
112+
113+ **Status:**
114+
115+ - :attr:`~scim2_tester.Status.SUCCESS`: Server returns :class:`~scim2_models.Error` object with 404 status
116+ - :attr:`~scim2_tester.Status.ERROR`: Server returns non-:class:`~scim2_models.Error` object or incorrect status
117+
118+ .. pull-quote:: :rfc:`RFC 7644 Section 3.12 - Error Response Handling <7644#section-3.12>`
119+
120+ "When returning HTTP error status codes, the server SHOULD return a SCIM error response."
121+ """
63122 probably_invalid_id = str (uuid .uuid4 ())
64123 response = context .client .query (
65124 ResourceType ,
0 commit comments