Reference#

Checkers#

SCIM server compliance checkers.

This module contains all the individual checkers for validating SCIM server implementations. Each checker is decorated with tags that allow selective test execution.

Available checker categories:

  • discovery: ServiceProviderConfig, ResourceTypes, Schemas endpoints

  • crud: Create, Read, Update, Delete operations

  • misc: Random URL access tests

scim2_tester.checkers.access_invalid_resource_type(context: CheckContext) → list[CheckResult][source]#

Validate error handling for non-existent resource type IDs.

Tests that accessing /ResourceTypes/{invalid_id} with a non-existent resource type ID returns appropriate Error object with 404 status.

Status:

  • SUCCESS: Server returns Error object with 404 status

  • ERROR: Server returns non-Error object or incorrect status

RFC 7644 Section 3.12 - Error Response Handling

“In addition to returning an HTTP response code, implementers MUST return the errors in the body of the response in a JSON format”

scim2_tester.checkers.access_invalid_schema(context: CheckContext) → list[CheckResult][source]#

Validate error handling for non-existent schema IDs.

Tests that accessing /Schemas/{invalid_id} with a non-existent schema ID returns appropriate Error object with 404 status.

Status:

  • SUCCESS: Server returns Error object with 404 status

  • ERROR: Server returns non-Error object or incorrect status

RFC 7644 Section 3.12 - Error Response Handling

“In addition to returning an HTTP response code, implementers MUST return the errors in the body of the response in a JSON format”

scim2_tester.checkers.access_schema_by_id(context: CheckContext) → list[CheckResult][source]#

Validate individual schema retrieval by ID.

Tests that all schemas can be retrieved using GET requests to /Schemas/{id} with their complete attribute definitions and metadata.

Status:

  • SUCCESS: All schemas retrieved successfully with valid data

  • ERROR: One or more schemas failed to retrieve

RFC 7644 Section 7 - Schema Definition

“Each schema specifies the name of the resource, the resource’s base URI, and any attributes (including sub-attributes) of the resource.”

scim2_tester.checkers.check_add_attribute(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Test PATCH add operation on all attributes (simple, complex, and extensions).

Creates a minimal resource, then iterates over ALL possible URNs (base model, extensions, and sub-attributes) to test PATCH add operations systematically. Uses a unified approach that handles all attribute types consistently.

Tested Behavior: - Adding new attribute values (simple, complex, and extension attributes) - Server accepts the PATCH request with correct URN paths for extensions - Response contains the added attribute with correct values

Status: - SUCCESS: Attribute successfully added - ERROR: Failed to add attribute - SKIPPED: No addable attributes found or PATCH not supported

RFC 7644 Section 3.5.2.1 - Add Operation

“The ‘add’ operation is used to add a new attribute and/or values to an existing resource.”

scim2_tester.checkers.check_remove_attribute(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Test PATCH remove operation on all attributes (simple, complex, and extensions).

Creates a resource with initial values, then iterates over ALL possible URNs (base model, extensions, and sub-attributes) to test PATCH remove operations systematically. Uses a unified approach that handles all attribute types consistently.

Tested Behavior: - Removing attribute values (simple, complex, and extension attributes) - Server accepts the PATCH request with correct URN paths for extensions - Response contains the resource with removed attributes (null/missing)

Status: - SUCCESS: Attribute successfully removed - ERROR: Failed to remove attribute or attribute still exists - SKIPPED: No removable attributes found or PATCH not supported

RFC 7644 Section 3.5.2.2 - Remove Operation

“The ‘remove’ operation removes the value at the target location specified by the required attribute ‘path’. The operation performs the following functions, depending on the target location specified by ‘path’.”

scim2_tester.checkers.check_remove_required_attribute(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate that PATCH rejects the removal of a required attribute.

For each required attribute, creates a resource, then sends a PATCH remove operation on this attribute. Returns one result per attribute.

Status:

  • SUCCESS: The server answers 400 mutability

  • DEVIATION: The server answers 400 with another scimType or without one, another 4xx status, or an error without a SCIM body

  • ERROR: The server removes the attribute, or answers 5xx

  • SKIPPED: The resource has no required attribute to check, or PATCH is not supported

RFC 7644 Section 3.5.2.2 - Remove Operation

“If an attribute is removed or becomes unassigned and is defined as a required attribute or a read-only attribute, the server SHALL return an HTTP response status code and a JSON detail error response as defined in Section 3.12, with a “scimType” error code of “mutability”.”

scim2_tester.checkers.check_replace_attribute(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Test PATCH replace operation on all attributes (simple, complex, and extensions).

Creates a resource with initial values, then iterates over ALL possible URNs (base model, extensions, and sub-attributes) to test PATCH replace operations systematically. Uses a unified approach that handles all attribute types consistently.

Tested Behavior: - Replacing existing attribute values (simple, complex, and extension attributes) - Server accepts the PATCH request with correct URN paths for extensions - Response contains the replaced attribute with correct new values

Status: - SUCCESS: Attribute successfully replaced - ERROR: Failed to replace attribute - SKIPPED: No replaceable attributes found or PATCH not supported

RFC 7644 Section 3.5.2.3 - Replace Operation

“The ‘replace’ operation replaces the value at the target location specified by the ‘path’.”

scim2_tester.checkers.core_schemas_validation(context: CheckContext) → list[CheckResult][source]#

Validate that mandatory core schemas are provided.

Tests that the /Schemas endpoint provides the three mandatory core schemas: ResourceType, ServiceProviderConfig, and Schema schemas themselves.

Status:

  • SUCCESS: All mandatory core schemas are present

  • ERROR: One or more mandatory schemas are missing

RFC 7644 Section 4 - Service Provider Configuration Endpoints

“Service providers MUST provide this endpoint.”

The core schemas for ResourceType, ServiceProviderConfig, and Schema objects are fundamental to SCIM operation and should always be available.

scim2_tester.checkers.object_creation(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate SCIM resource creation via POST requests.

Tests that resources can be successfully created using POST method on the appropriate resource endpoint, with automatic cleanup after validation. Creates a test object with all required fields populated with valid data.

Status:

  • SUCCESS: Resource created successfully with valid response

  • ACCEPTABLE: The server answers 501, as it does not support the creation of this resource type

  • ERROR: Creation failed due to client/server error

RFC 7644 Section 3.3 - Creating Resources

“To create new resources, clients send HTTP POST requests to the resource endpoint, such as /Users or /Groups.”

“If the resource is successfully created, the server SHALL return a 201 ‘Created’ response code with the newly created resource.”

RFC 7644 Section 3.12 - HTTP Status and Error Response Handling

501 (Not Implemented): “Service provider does not support the request operation, e.g., PATCH.”

scim2_tester.checkers.object_creation_with_invalid_syntax(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate that POST rejects a body that is not valid JSON.

Sends a truncated JSON body to the resource endpoint.

Status:

  • SUCCESS: The server answers 400 invalidSyntax

  • ACCEPTABLE: The server answers 400 without a scimType

  • DEVIATION: The server answers 400 with another scimType, another 4xx status, or an error without a SCIM body

  • ERROR: The server creates a resource, or answers 5xx

RFC 7644 Section 3.12

“invalidSyntax: The request body message structure was invalid or did not conform to the request schema.”

The scimType is optional in an error response, so a 400 without it is acceptable.

scim2_tester.checkers.object_creation_without_required_attribute(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate that POST rejects a resource without one of its required attributes.

For each required attribute, sends a resource with all the other required attributes, and without this one. Returns one result per attribute.

Status:

  • SUCCESS: The server answers 400 invalidValue

  • ACCEPTABLE: The server answers 400 without a scimType

  • DEVIATION: The server answers 400 with another scimType, another 4xx status, or an error without a SCIM body

  • ERROR: The server creates the resource, or answers 5xx

  • SKIPPED: The resource has no required attribute to check

RFC 7644 Section 3.12

“invalidValue: A required value was missing, or the value specified was not compatible with the operation or attribute type.”

The scimType is optional in an error response, so a 400 without it is acceptable.

scim2_tester.checkers.object_deletion(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate SCIM resource deletion via DELETE requests.

Tests that resources can be successfully deleted using DELETE method and verifies that the server returns HTTP 404 when attempting to retrieve the deleted resource.

Status:

  • SUCCESS: Resource deleted successfully and server returns 404 on retrieval

  • ERROR: Deletion failed, resource still exists, or server does not return 404

RFC 7644 Section 3.6 - Deleting Resources

“Clients request resource removal via HTTP DELETE requests to the resource endpoint (e.g., /Users/{id} or /Groups/{id}).”

“In response to a successful DELETE, the server SHALL return HTTP status code 204 (No Content).”

“If a client sends a retrieval request and the consumer has been deleted, the server responds with HTTP status code 404.”

scim2_tester.checkers.object_list_with_attributes(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate that GET on the collection endpoint honours attributes.

Same as object_query_with_attributes, on the list of the resources.

Status:

  • SUCCESS: The response has the expected attributes

  • ERROR: An attribute is missing or unexpected, or the resource is not in the list

  • SKIPPED: The resource has no attribute to check

RFC 7644 Section 3.4.2

“Clients MAY use the attributes query parameter to request particular attributes be included in a query response.”

scim2_tester.checkers.object_list_with_excluded_attributes(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate that GET on the collection endpoint honours excludedAttributes.

Same as object_query_with_excluded_attributes, on the list of the resources.

Status:

  • SUCCESS: The response has the expected attributes

  • ERROR: An attribute is missing or unexpected, or the resource is not in the list

  • SKIPPED: The resource has no attribute to check

RFC 7644 Section 3.4.2.5

“excludedAttributes: A multi-valued list of strings indicating the names of resource attributes to be removed from the default set of attributes to return.”

scim2_tester.checkers.object_query(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate SCIM resource retrieval by ID via GET requests.

Tests that individual resources can be successfully retrieved using GET method on the resource endpoint with specific resource ID, with automatic cleanup.

Status:

  • SUCCESS: Resource retrieved successfully with valid data

  • ERROR: Failed to retrieve or received invalid response

RFC 7644 Section 3.4.1 - Retrieving a Known Resource

“Clients retrieve a known resource using an HTTP GET request to the resource endpoint, such as /Users/{id} or /Groups/{id}.”

“If successful, the server responds with HTTP status code 200 (OK) and includes the target resource within the response body.”

scim2_tester.checkers.object_query_with_attributes(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate that GET on a single resource honours attributes.

Creates a resource with all writable attributes, then retrieves it once per attribute, with attributes set to this attribute. Returns one result per attribute.

The response must have the requested attribute, unless it is never returned, and the attributes that are always returned. It must not have the other attributes.

Status:

  • SUCCESS: The response has the expected attributes

  • ERROR: An attribute is missing or unexpected

  • SKIPPED: The resource has no attribute to check

RFC 7644 Section 3.4.2.5

“attributes: A multi-valued list of strings indicating the names of resource attributes to return in the response, overriding the set of attributes that would be returned by default.”

scim2_tester.checkers.object_query_with_excluded_attributes(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate that GET on a single resource honours excludedAttributes.

Creates a resource with all writable attributes, then retrieves it once per attribute, with excludedAttributes set to this attribute. Returns one result per attribute.

The response must not have the excluded attribute, unless it is always returned. It must have the other attributes returned by default.

Status:

  • SUCCESS: The response has the expected attributes

  • ERROR: An attribute is missing or unexpected

  • SKIPPED: The resource has no attribute to check

RFC 7644 Section 3.4.2.5

“excludedAttributes: A multi-valued list of strings indicating the names of resource attributes to be removed from the default set of attributes to return. This parameter SHALL have no effect on attributes whose schema “returned” setting is “always”.”

scim2_tester.checkers.object_query_without_id(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate SCIM resource listing via GET requests without ID.

Tests that resources can be successfully listed using GET method on the collection endpoint, validating bulk retrieval with automatic cleanup.

Status:

  • SUCCESS: Resources listed successfully, created resource found

  • ERROR: Failed to list resources or created resource not found

RFC 7644 Section 3.4.2 - List/Query Resources

“To query resources, clients send GET requests to the resource endpoint (e.g., /Users or /Groups). The response to a successful query operation SHALL be a JSON structure that matches the ListResponse schema.”

scim2_tester.checkers.object_replacement(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate SCIM resource replacement via PUT requests.

Tests that resources can be successfully replaced using PUT method, modifying mutable fields and validating the complete resource replacement operation.

Status:

  • SUCCESS: Resource replaced successfully with valid response

  • ERROR: Replacement failed due to client/server error

RFC 7644 Section 3.5.1 - Replacing Resources

“To replace a resource’s attributes, clients issue an HTTP PUT request to the resource endpoint (e.g., /Users/{id} or /Groups/{id}).”

“If successful, the server responds with HTTP status code 200 (OK) and includes the updated resource within the response body.”

scim2_tester.checkers.object_replacement_with_invalid_syntax(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate that PUT rejects a body that is not valid JSON.

Creates a resource, then replaces it with a truncated JSON body.

Status:

  • SUCCESS: The server answers 400 invalidSyntax

  • ACCEPTABLE: The server answers 400 without a scimType

  • DEVIATION: The server answers 400 with another scimType, another 4xx status, or an error without a SCIM body

  • ERROR: The server replaces the resource, or answers 5xx

RFC 7644 Section 3.12

“invalidSyntax: The request body message structure was invalid or did not conform to the request schema.”

The scimType is optional in an error response, so a 400 without it is acceptable.

scim2_tester.checkers.object_replacement_without_required_attribute(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate that PUT rejects a resource without one of its required attributes.

For each required attribute, creates a resource, then replaces it with the same resource without this attribute. Returns one result per attribute.

Status:

  • SUCCESS: The server answers 400 invalidValue

  • ACCEPTABLE: The server answers 400 without a scimType

  • DEVIATION: The server answers 400 with another scimType, another 4xx status, or an error without a SCIM body

  • ERROR: The server replaces the resource, or answers 5xx

  • SKIPPED: The resource has no required attribute to check

RFC 7644 Section 3.5.1

“If an attribute is “required”, clients MUST specify the attribute in the PUT request.”

RFC 7644 Section 3.12

“invalidValue: A required value was missing, or the value specified was not compatible with the operation or attribute type.”

The scimType is optional in an error response, so a 400 without it is acceptable.

scim2_tester.checkers.query_all_resource_types(context: CheckContext) → list[CheckResult][source]#

Validate retrieval of all available resource types.

Tests that the /ResourceTypes endpoint returns a list of all supported resource types with their metadata, schemas, and endpoint information.

Status:

  • SUCCESS: Endpoint returns valid list of ResourceType objects

  • ERROR: Endpoint is inaccessible or returns invalid response

RFC 7644 Section 4 - Service Provider Configuration Endpoints

“An HTTP GET to this endpoint is used to discover the types of resources available on a SCIM service provider (e.g., Users and Groups).”

scim2_tester.checkers.query_all_schemas(context: CheckContext) → list[CheckResult][source]#

Validate retrieval of all available schemas.

Tests that the /Schemas endpoint returns a complete list of all supported schemas including core schemas, extensions, and custom schemas.

Status:

  • SUCCESS: Endpoint returns valid list of Schema objects

  • ERROR: Endpoint is inaccessible or returns invalid response

RFC 7644 Section 4 - Service Provider Configuration Endpoints

“An HTTP GET to this endpoint is used to retrieve information about resource schemas supported by a SCIM service provider.”

scim2_tester.checkers.query_resource_type_by_id(context: CheckContext, resource_type: ResourceType) → list[CheckResult][source]#

Validate individual ResourceType retrieval by ID.

Tests that specific resource types can be retrieved using GET requests to /ResourceTypes/{id} with their complete metadata and configuration.

Status:

RFC 7644 Section 4 - Service Provider Configuration Endpoints

“Each resource type defines the endpoint, the core schema URI that defines the resource, and any supported schema extensions.”

scim2_tester.checkers.random_url(context: CheckContext) → list[CheckResult][source]#

Validate server error handling for non-existent endpoints.

Tests that the server properly returns a Error object with HTTP 404 status when accessing invalid or non-existent URLs, ensuring compliance with SCIM error handling requirements.

Status:

  • SUCCESS: Server returns valid Error object with 404 status

  • ERROR: Server returns non-Error object or incorrect status code

RFC 7644 Section 3.12 - Error Response Handling

“In addition to returning an HTTP response code, implementers MUST return the errors in the body of the response in a JSON format”

scim2_tester.checkers.resource_type_by_id_methods(context: CheckContext, resource_type: ResourceType) → list[CheckResult][source]#

Validate that unsupported HTTP methods on a resource type return 405 Method Not Allowed.

Tests that POST, PUT, PATCH, and DELETE methods on the /ResourceTypes/{id} endpoint return HTTP 405 Method Not Allowed, as RFC 7644 §4 only defines GET.

Status:

  • SUCCESS: Every method returns 405

  • DEVIATION: A method returns 404, 501 or another 4xx status

  • ERROR: A method succeeds, or returns another 5xx status

The check returns one result, with the worst status of the methods.

RFC 7644 Section 4 - Service Provider Configuration Endpoints

“SCIM defines three endpoints to facilitate discovery of SCIM service provider features and schema that MAY be retrieved using HTTP GET”

RFC 9110 Section 15.5.6 - 405 Method Not Allowed

“The 405 (Method Not Allowed) status code indicates that the method received in the request-line is known by the origin server but not supported by the target resource.”

scim2_tester.checkers.resource_type_tests(context: CheckContext, resource_type: ResourceType) → list[CheckResult][source]#

Orchestrate comprehensive CRUD testing for a specific resource type.

Runs the complete suite of CRUD operations (Create, Read, Update, Delete) on a given resource type to validate full lifecycle management compliance.

Status:

  • SUCCESS: All CRUD operations completed successfully

  • ERROR: One or more CRUD operations failed or no schema found

RFC 7644 Section 3 - SCIM Protocol

“SCIM is intended to reduce the cost and complexity of user management operations by providing a common user schema and extension model, as well as binding documents to provide patterns for exchanging this schema using standard protocols.”

scim2_tester.checkers.resource_types_endpoint_methods(context: CheckContext) → list[CheckResult][source]#

Validate that unsupported HTTP methods return 405 Method Not Allowed.

Tests that POST, PUT, PATCH, and DELETE methods on the /ResourceTypes endpoint return HTTP 405 Method Not Allowed, as RFC 7644 §4 only defines GET.

Status:

  • SUCCESS: Every method returns 405

  • DEVIATION: A method returns 404, 501 or another 4xx status

  • ERROR: A method succeeds, or returns another 5xx status

The check returns one result, with the worst status of the methods.

RFC 7644 Section 4 - Service Provider Configuration Endpoints

“An HTTP GET to this endpoint is used to discover the types of resources available on a SCIM service provider.”

RFC 9110 Section 15.5.6 - 405 Method Not Allowed

“The 405 (Method Not Allowed) status code indicates that the method received in the request-line is known by the origin server but not supported by the target resource.”

scim2_tester.checkers.resource_types_schema_validation(context: CheckContext) → list[CheckResult][source]#

Validate that ResourceType schemas exist and are accessible.

Tests that all ResourceType objects returned by the /ResourceTypes endpoint reference valid schemas that can be retrieved from the /Schemas endpoint.

Status:

  • SUCCESS: All ResourceType schemas are accessible

  • ERROR: One or more ResourceType schemas are missing or inaccessible

RFC 7644 Section 4 - Service Provider Configuration Endpoints

“Each resource type defines the endpoint, the core schema URI that defines the resource, and any supported schema extensions.”

scim2_tester.checkers.schema_by_id_methods(context: CheckContext, schema: Schema) → list[CheckResult][source]#

Validate that unsupported HTTP methods on a schema return 405 Method Not Allowed.

Tests that POST, PUT, PATCH, and DELETE methods on the /Schemas/{id} endpoint return HTTP 405 Method Not Allowed, as RFC 7644 §4 only defines GET.

Status:

  • SUCCESS: Every method returns 405

  • DEVIATION: A method returns 404, 501 or another 4xx status

  • ERROR: A method succeeds, or returns another 5xx status

The check returns one result, with the worst status of the methods.

RFC 7644 Section 4 - Service Provider Configuration Endpoints

“Individual schema definitions can be returned by appending the schema URI to the /Schemas endpoint.”

RFC 9110 Section 15.5.6 - 405 Method Not Allowed

“The 405 (Method Not Allowed) status code indicates that the method received in the request-line is known by the origin server but not supported by the target resource.”

scim2_tester.checkers.schemas_endpoint_methods(context: CheckContext) → list[CheckResult][source]#

Validate that unsupported HTTP methods return 405 Method Not Allowed.

Tests that POST, PUT, PATCH, and DELETE methods on the /Schemas endpoint return HTTP 405 Method Not Allowed, as RFC 7644 §4 only defines GET.

Status:

  • SUCCESS: Every method returns 405

  • DEVIATION: A method returns 404, 501 or another 4xx status

  • ERROR: A method succeeds, or returns another 5xx status

The check returns one result, with the worst status of the methods.

RFC 7644 Section 4 - Service Provider Configuration Endpoints

“An HTTP GET to this endpoint is used to retrieve information about resource schemas supported by a SCIM service provider.”

RFC 9110 Section 15.5.6 - 405 Method Not Allowed

“The 405 (Method Not Allowed) status code indicates that the method received in the request-line is known by the origin server but not supported by the target resource.”

scim2_tester.checkers.search_with_attributes(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate that POST /.search honours attributes.

Same as object_query_with_attributes, on a search at the root.

Status:

  • SUCCESS: The response has the expected attributes

  • ERROR: An attribute is missing or unexpected, or the resource is not in the results

  • SKIPPED: The resource has no attribute to check, or the server does not search several resource types at once

RFC 7644 Section 3.4.3

“Clients MAY execute queries without passing parameters on the URL by using the HTTP POST verb combined with the /.search path extension.”

RFC 7644 Section 3.12

“501 (Not Implemented): Service provider does not support the request operation, e.g., PATCH.”

A server that does not search several resource types at once answers 501. The service provider configuration has no attribute to announce it.

scim2_tester.checkers.search_with_excluded_attributes(context: CheckContext, model: type[Resource]) → list[CheckResult][source]#

Validate that POST /.search honours excludedAttributes.

Same as object_query_with_excluded_attributes, on a search at the root.

Status:

  • SUCCESS: The response has the expected attributes

  • ERROR: An attribute is missing or unexpected, or the resource is not in the results

  • SKIPPED: The resource has no attribute to check, or the server does not search several resource types at once

RFC 7644 Section 3.4.3

“Clients MAY execute queries without passing parameters on the URL by using the HTTP POST verb combined with the /.search path extension.”

A server that does not search several resource types at once answers 501.

scim2_tester.checkers.service_provider_config_endpoint(context: CheckContext) → list[CheckResult][source]#

Validate the mandatory ServiceProviderConfig discovery endpoint.

Tests that the /ServiceProviderConfig endpoint is accessible via GET request and returns a valid ServiceProviderConfig object containing server capabilities and supported features.

Status:

RFC 7644 Section 4 - Service Provider Configuration Endpoints

“An HTTP GET to this endpoint will return a JSON structure that describes the SCIM specification features available on a service provider.”

“Service providers MUST provide this endpoint.”

scim2_tester.checkers.service_provider_config_endpoint_methods(context: CheckContext) → list[CheckResult][source]#

Validate that unsupported HTTP methods return 405 Method Not Allowed.

Tests that POST, PUT, PATCH, and DELETE methods on the /ServiceProviderConfig endpoint return HTTP 405 Method Not Allowed, as RFC 7644 §4 only defines GET.

Status:

  • SUCCESS: Every method returns 405

  • DEVIATION: A method returns 404, 501 or another 4xx status

  • ERROR: A method succeeds, or returns another 5xx status

The check returns one result, with the worst status of the methods.

RFC 7644 Section 4 - Service Provider Configuration Endpoints

“An HTTP GET to this endpoint will return a JSON structure that describes the SCIM specification features available on a service provider.”

RFC 9110 Section 15.5.6 - 405 Method Not Allowed

“The 405 (Method Not Allowed) status code indicates that the method received in the request-line is known by the origin server but not supported by the target resource.”

Public API#

class scim2_tester.CheckConfig(raise_exceptions: bool = False, expected_status_codes: list[int] | None = None, include_tags: set[str] | None = None, exclude_tags: set[str] | None = None, resource_types: list[str] | None = None, seed: int | None = None)[source]#

Configuration for check behavior.

exclude_tags: set[str] | None = None#

Skip checks with any of these tags.

expected_status_codes: list[int] | None = None#

The expected response status codes.

include_tags: set[str] | None = None#

Execute only checks with at least one of these tags.

raise_exceptions: bool = False#

Whether to raise exceptions or store them in a Result object.

resource_types: list[str] | None = None#

Filter by resource type names (e.g., [“User”, “Group”]).

seed: int | None = None#

The seed of the generated values.

Two runs with the same seed send the same values. Without a seed, each run sends new values.

class scim2_tester.CheckResult(status: Status, title: str | None = None, description: str | None = None, reason: str | None = None, data: Any | None = None, tags: set[str] = <factory>, resource_type: str | None = None, attribute: str | None = None)[source]#

Store a check result.

attribute: str | None = None#

The path of the attribute if this check is related to a specific attribute.

For instance externalId, name.givenName, or urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:employeeNumber.

data: Any | None = None#

Any related data that can help to debug.

description: str | None = None#

What the check does, and why the spec advises it to do.

reason: str | None = None#

Why it failed, or how it succeed.

resource_type: str | None = None#

The resource type name if this check is related to a specific resource.

tags: set[str]#

Tags associated with this check for filtering.

title: str | None = None#

The title of the check.

class scim2_tester.Outcome(*values)[source]#

Whether a result passes, warns, fails or is skipped.

FAILED = 3#

The server behavior violates a requirement of the RFCs.

PASSED = 1#

The server behavior is allowed by the RFCs.

SKIPPED = 4#

The check was not executed.

WARNING = 2#

The server behavior deviates from a recommendation of the RFCs.

exception scim2_tester.SCIMTesterError(message: str, conf: CheckConfig)[source]#

Exception raised when a check failed and the raise_exceptions config parameter is True.

class scim2_tester.Status(*values)[source]#
ACCEPTABLE = 3#

Server behavior is RFC-compliant but uses optional features (MAY) or applies robustness principle reasonably.

COMPLIANT = 2#

Server behavior follows RFC recommendations (SHOULD/SHOULD NOT) correctly.

CRITICAL = 6#

Server behavior creates security risks or fundamental protocol violations.

DEVIATION = 4#

Server behavior deviates from RFC recommendations (SHOULD/SHOULD NOT) but remains within specification bounds.

ERROR = 5#

Server behavior violates mandatory RFC requirements (MUST/MUST NOT).

SKIPPED = 7#

Check was not executed due to filtering or prerequisites.

SUCCESS = 1#

Server behavior strictly conforms to RFC requirements (MUST/MUST NOT).

property outcome: Outcome#

Whether a result with this status passes, warns, fails or is skipped.

scim2_tester.check_server(client: BaseSyncSCIMClient, raise_exceptions: bool = False, include_tags: set[str] | None = None, exclude_tags: set[str] | None = None, resource_types: list[str] | None = None, seed: int | None = None) → list[CheckResult][source]#

Perform a series of check to a SCIM server, and return all the results at once.

It performs the checks of iter_check_server(). Use iter_check_server() to get the results as soon as they are known.

Parameters:
  • client – A SCIM client that will perform the requests.

  • raise_exceptions – Whether exceptions should be raised or stored in a CheckResult object.

  • include_tags – Execute only checks with at least one of these tags.

  • exclude_tags – Skip checks with any of these tags.

  • resource_types – Filter by resource type names (e.g., [“User”, “Group”]).

  • seed – The seed of the generated values. Two runs with the same seed send the same values, which helps to replay a failure. Without a seed, each run sends new values.

Example usage:

# Run only discovery tests
results = check_server(client, include_tags={"discovery"})

# Run CRUD tests except delete operations
results = check_server(
    client, include_tags={"crud"}, exclude_tags={"crud:delete"}
)

# Test only User resources
results = check_server(client, resource_types=["User"])

# Test only User creation and reading
results = check_server(
    client, include_tags={"crud:create", "crud:read"}, resource_types=["User"]
)
scim2_tester.get_all_available_tags() → list[str][source]#

Get all available tags from the global registry.

This function returns tags that have been registered by checker decorators throughout the codebase. The registration happens automatically when modules containing @checker decorators are imported.

Returns:

Set of all unique tags found in the codebase.

scim2_tester.get_standard_resource_types() → list[str][source]#

Get standard SCIM resource types.

Returns:

List of standard resource type names.

scim2_tester.iter_check_server(client: BaseSyncSCIMClient, raise_exceptions: bool = False, include_tags: set[str] | None = None, exclude_tags: set[str] | None = None, resource_types: list[str] | None = None, seed: int | None = None) → Iterator[CheckResult][source]#

Perform a series of check to a SCIM server, and yield each result as soon as it is known.

It starts by retrieving the standard ServiceProviderConfig, Schema and ResourceType endpoints. What they publish describes the server as a ScimProvider registered on the client, leaving untouched whatever the client already described.

Then for all available resources (whether they have been manually configured in the client, or dynamically discovered by the checker), it perform a series of creation, query, replacement and deletion.

Checking a remote server can take a while. The results come as each check ends, so they can be displayed during the run. Stopping the iteration stops the run, and leaves no resource created by the checks on the server. With raise_exceptions, the error is raised during the iteration, after the results of the previous checks.

Parameters:
  • client – A SCIM client that will perform the requests.

  • raise_exceptions – Whether exceptions should be raised or stored in a CheckResult object.

  • include_tags – Execute only checks with at least one of these tags.

  • exclude_tags – Skip checks with any of these tags.

  • resource_types – Filter by resource type names (e.g., [“User”, “Group”]).

  • seed – The seed of the generated values. Two runs with the same seed send the same values, which helps to replay a failure. Without a seed, each run sends new values.

Available tags:
  • discovery: Tests for configuration endpoints (ServiceProviderConfig, ResourceTypes, Schemas)

  • service-provider-config: Tests for ServiceProviderConfig endpoint

  • resource-types: Tests for ResourceTypes endpoint

  • schemas: Tests for Schemas endpoint

  • crud: All CRUD operation tests

  • crud:create: Resource creation tests

  • crud:read: Resource reading tests

  • crud:update: Resource update tests

  • crud:delete: Resource deletion tests

  • misc: Miscellaneous tests (e.g., random URL access)

Example usage:

for result in iter_check_server(client):
    print(result.status.name, result.title)

# Run CRUD tests except delete operations, on User resources only
for result in iter_check_server(
    client,
    include_tags={"crud"},
    exclude_tags={"crud:delete"},
    resource_types=["User"],
):
    print(result.status.name, result.title)

Testing#

A test suite checking that a SCIM server follows the RFCs.

Subclass ScimServerContract in the tests of a server, and give it a scim_client fixture returning a client of the server:

import pytest
from scim2_client.engines.wsgi import WSGISCIMClient
from scim2_tester.testing import ScimServerContract


class TestMyServer(ScimServerContract):
    @pytest.fixture
    def scim_client(self):
        return WSGISCIMClient(create_app(), base_url="http://localhost/scim/v2")

The suite needs the testing extra, which installs pytest.

scim2_tester.testing.ExpectedResult = scim2_tester.utils.Status | tuple[scim2_tester.utils.Status, str]#

The expected status of a result, alone or with a reason.

scim2_tester.testing.ResultKey#

The key of a result: its resource type, its title and its attribute.

alias of tuple[str | None, str | None, str | None]

exception scim2_tester.testing.ScimDeviationWarning[source]#

A server behavior that deviates from a recommendation of the RFCs.

It is emitted for the DEVIATION results. Turn it into an error to make such results fail:

[tool.pytest.ini_options]
filterwarnings = ["error::scim2_tester.testing.ScimDeviationWarning"]
class scim2_tester.testing.ScimServerContract[source]#

The checks of check_server(), as a pytest test.

The test runs the checks once, and reports each result as a subtest, according to the outcome of its status:

The results listed in expected_results are expected failures instead.

When a check fails on an exception, such as one raised by the server code, the failed subtest shows its traceback.

The seed of the generated values, and the failures in the format of expected_results, are printed in the output of the test.

exclude_tags: set[str] | None = None#

Skip checks with any of these tags.

expected_results: dict[tuple[str | None, str | None, str | None], Status | tuple[Status, str]] = {}#

The known failures of the server, with their status and an optional reason.

The key of a result is its resource_type, its title and its attribute. The value is the expected status, or a tuple of the status and a reason. The reason is free text, printed in the report, such as a ticket URL or an explanation:

expected_results = {
    ("User", "check_add_attribute", "nickName"): (
        Status.ERROR,
        "https://github.com/example/scim-server/issues/123",
    ),
    (None, "schemas_endpoint_methods", None): Status.DEVIATION,
}

A result with the expected status is an expected failure. A result with another status fails, including a result that now passes. An expected result that the checks do not return fails the test.

A key applies to all the results that have it. When these results have different statuses and one of them fails, the key cannot be expected, and the test fails.

include_tags: set[str] | None = None#

Execute only checks with at least one of these tags.

resource_types: list[str] | None = None#

Check only these resource types, for instance ["User", "Group"].

seed: int | None = None#

The seed of the generated values.

Without a seed, each run sends new values. Set the seed printed by a failed run to replay it.

test_check_server(scim_client: BaseSyncSCIMClient, subtests: Subtests) → None[source]#

The server passes the checks of scim2-tester.

scim2_tester.testing.result_key(result: CheckResult) → tuple[str | None, str | None, str | None][source]#

Return the key of a result in ScimServerContract.expected_results.