Skip to content

Commit d7a0de4

Browse files
committed
fix: unit tests
1 parent e599f53 commit d7a0de4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

scim2_client/client.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,6 @@ def get_resource_model(self, name: str) -> Optional[type[Resource]]:
205205
def _check_resource_model(
206206
self, resource_model: type[Resource], payload=None
207207
) -> None:
208-
# We need to check the actual schema names, comparing the class
209-
# types does not work because if the resource_models are
210-
# discovered. The classes might differ:
211-
# <class 'scim2_models.rfc7643.user.User'> vs <class 'scim2_models.rfc7643.schema.User'>
212208
schema_to_check = resource_model.model_fields["schemas"].default[0]
213209
for element in self.resource_models:
214210
schema = element.model_fields["schemas"].default[0]

tests/test_delete.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import pytest
22
from scim2_models import Error
3-
from scim2_models import Group
3+
from scim2_models import Resource
44
from scim2_models import User
55

66
from scim2_client import RequestNetworkError
77
from scim2_client import SCIMRequestError
88

99

10+
class UnregisteredResource(Resource):
11+
schemas: list[str] = ["urn:test:schemas:UnregisteredResource"]
12+
13+
1014
def test_delete_user(httpserver, sync_client):
1115
"""Nominal case for a User deletion."""
1216
httpserver.expect_request(
@@ -45,7 +49,7 @@ def test_errors(httpserver, code, sync_client):
4549
def test_invalid_resource_model(httpserver, sync_client):
4650
"""Test that resource_models passed to the method must be part of SCIMClient.resource_models."""
4751
with pytest.raises(SCIMRequestError, match=r"Unknown resource type"):
48-
sync_client.delete(Group(display_name="foobar"), id="foobar")
52+
sync_client.delete(UnregisteredResource, id="foobar")
4953

5054

5155
def test_dont_check_response_payload(httpserver, sync_client):

0 commit comments

Comments
 (0)