Skip to content

Commit 711e988

Browse files
committed
fix: use the configuration resources from the client if they have been
passed explicitly
1 parent 6133a1c commit 711e988

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

scim2_tester/checker.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,34 @@ def check_server(client: SCIMClient, raise_exceptions=False) -> list[CheckResult
4949
5050
It starts by retrieving the standard :class:`~scim2_models.ServiceProviderConfig`,
5151
:class:`~scim2_models.Schema` and :class:`~scim2_models.ResourceType` endpoints.
52+
Those configuration resources will be registered to the client if no other have been registered yet.
5253
53-
Then for all discovered resources, it perform a series of creation, query, replacement and deletion.
54+
Then for all available resources (whether they have been manually configured in the client,
55+
or dynamically discovered by the checker), it perform a series of creation, query, replacement and deletion.
5456
55-
:param scim: A SCIM client that will perform the requests.
57+
:param client: A SCIM client that will perform the requests.
5658
:param raise_exceptions: Whether exceptions should be raised or stored in a :class:`~scim2_tester.CheckResult` object.
5759
"""
5860
conf = CheckConfig(client, raise_exceptions)
5961
results = []
6062

6163
# Get the initial basic objects
6264
result_spc = check_service_provider_config_endpoint(conf)
63-
conf.client.service_provider_config = result_spc.data
6465
results.append(result_spc)
66+
if not conf.client.service_provider_config:
67+
conf.client.service_provider_config = result_spc.data
6568

6669
results_resource_types = check_resource_types_endpoint(conf)
67-
conf.client.resource_types = results_resource_types[0].data
6870
results.extend(results_resource_types)
71+
if not conf.client.resource_types:
72+
conf.client.resource_types = results_resource_types[0].data
6973

7074
results_schemas = check_schemas_endpoint(conf)
7175
results.extend(results_schemas)
72-
conf.client.resource_models = conf.client.build_resource_models(
73-
conf.client.resource_types or [], results_schemas[0].data or []
74-
)
76+
if not conf.client.resource_models:
77+
conf.client.resource_models = conf.client.build_resource_models(
78+
conf.client.resource_types or [], results_schemas[0].data or []
79+
)
7580

7681
if (
7782
not conf.client.service_provider_config

0 commit comments

Comments
 (0)