11import argparse
2- import uuid
3- from typing import Any
42
53from scim2_client .engines .httpx import SyncSCIMClient
6- from scim2_models import Error
74
8- from scim2_tester .resource import check_resource_type
9- from scim2_tester .resource_types import check_resource_types_endpoint
10- from scim2_tester .schemas import check_schemas_endpoint
11- from scim2_tester .service_provider_config import check_service_provider_config_endpoint
5+ from scim2_tester .checkers import random_url
6+ from scim2_tester .checkers import resource_type_tests
7+ from scim2_tester .checkers import resource_types_endpoint
8+ from scim2_tester .checkers import schemas_endpoint
9+ from scim2_tester .checkers import service_provider_config_endpoint
1210from scim2_tester .utils import CheckConfig
1311from scim2_tester .utils import CheckContext
1412from scim2_tester .utils import CheckResult
1513from scim2_tester .utils import Status
16- from scim2_tester .utils import checker
17-
18-
19- @checker ("misc" )
20- def check_random_url (context : CheckContext ) -> CheckResult :
21- """Check that a request to a random URL returns a 404 Error object."""
22- probably_invalid_url = f"/{ str (uuid .uuid4 ())} "
23- response : Any = context .client .query (
24- url = probably_invalid_url , raise_scim_errors = False
25- )
26-
27- if not isinstance (response , Error ):
28- return CheckResult (
29- status = Status .ERROR ,
30- reason = f"{ probably_invalid_url } did not return an Error object" ,
31- data = response ,
32- )
33-
34- if response .status != 404 :
35- return CheckResult (
36- status = Status .ERROR ,
37- reason = f"{ probably_invalid_url } did return an object, but the status code is { response .status } " ,
38- data = response ,
39- )
40-
41- return CheckResult (
42- status = Status .SUCCESS ,
43- reason = f"{ probably_invalid_url } correctly returned a 404 error" ,
44- data = response ,
45- )
4614
4715
4816def check_server (
@@ -107,12 +75,12 @@ def check_server(
10775 results = []
10876
10977 # Get the initial basic objects
110- result_spc = check_service_provider_config_endpoint (context )
78+ result_spc = service_provider_config_endpoint (context )
11179 results .append (result_spc )
11280 if result_spc .status != Status .SKIPPED and not client .service_provider_config :
11381 client .service_provider_config = result_spc .data
11482
115- results_resource_types = check_resource_types_endpoint (context )
83+ results_resource_types = resource_types_endpoint (context )
11684 results .extend (results_resource_types )
11785 if not client .resource_types :
11886 # Find first non-skipped result with data
@@ -121,7 +89,7 @@ def check_server(
12189 client .resource_types = rt_result .data
12290 break
12391
124- results_schemas = check_schemas_endpoint (context )
92+ results_schemas = schemas_endpoint (context )
12593 results .extend (results_schemas )
12694 if not client .resource_models :
12795 # Find first non-skipped result with data
@@ -140,7 +108,7 @@ def check_server(
140108 return results
141109
142110 # Miscelleaneous checks
143- result_random = check_random_url (context )
111+ result_random = random_url (context )
144112 results .append (result_random )
145113
146114 # Resource checks
@@ -149,7 +117,7 @@ def check_server(
149117 if conf .resource_types and resource_type .name not in conf .resource_types :
150118 continue
151119
152- resource_results = check_resource_type (context , resource_type )
120+ resource_results = resource_type_tests (context , resource_type )
153121 # Add resource type to each result for better tracking
154122 for result in resource_results :
155123 result .resource_type = resource_type .name
0 commit comments