Skip to content

Commit b6ec0f6

Browse files
committed
chore: checker also checks for criticatl statuses
1 parent b931b7b commit b6ec0f6

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

scim2_tester/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,16 @@ def wrapped(context: CheckContext, *args: Any, **kwargs: Any) -> Any:
267267

268268
# Check for ERROR results and raise SCIMTesterError if configured
269269
if context.conf.raise_exceptions:
270-
if isinstance(result, CheckResult) and result.status == Status.ERROR:
270+
if isinstance(result, CheckResult) and result.status in (
271+
Status.ERROR,
272+
Status.CRITICAL,
273+
):
271274
raise SCIMTesterError(result.reason or "Check failed", context.conf)
272275
elif isinstance(result, list):
273276
errors = [
274277
SCIMTesterError(r.reason or "Check failed", context.conf)
275278
for r in result
276-
if r.status == Status.ERROR
279+
if r.status in (Status.ERROR, Status.CRITICAL)
277280
]
278281
if len(errors) == 1:
279282
raise errors[0]

tests/test_scim2_server.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ def test_discovered_scim2_server(scim2_server_app):
1616

1717
executed_results = [r for r in results if r.status != Status.SKIPPED]
1818
assert len(executed_results) > 0
19-
assert all(r.status in (Status.SUCCESS, Status.ERROR) for r in executed_results)
19+
assert all(
20+
r.status not in (Status.ERROR, Status.CRITICAL) for r in executed_results
21+
)
2022

2123

2224
def test_undiscovered_scim2_server(scim2_server_app):
@@ -26,7 +28,9 @@ def test_undiscovered_scim2_server(scim2_server_app):
2628

2729
executed_results = [r for r in results if r.status != Status.SKIPPED]
2830
assert len(executed_results) > 0
29-
assert all(r.status in (Status.SUCCESS, Status.ERROR) for r in executed_results)
31+
assert all(
32+
r.status not in (Status.ERROR, Status.CRITICAL) for r in executed_results
33+
)
3034

3135

3236
@pytest.mark.parametrize("tag", get_all_available_tags())
@@ -36,10 +40,10 @@ def test_individual_filters(scim2_server_app, tag, resource_type):
3640
client = TestSCIMClient(Client(scim2_server_app))
3741
client.discover()
3842
results = check_server(
39-
client, raise_exceptions=False, include_tags={tag}, resource_types=resource_type
43+
client, raise_exceptions=True, include_tags={tag}, resource_types=resource_type
4044
)
4145
for result in results:
42-
assert result.status in (Status.SKIPPED, Status.SUCCESS), (
46+
assert result.status not in (Status.ERROR, Status.CRITICAL), (
4347
f"Result {result.title} failed: {result.reason}"
4448
)
4549

0 commit comments

Comments
 (0)