Skip to content

Commit 86c033a

Browse files
committed
feat: TestSCIMClient can take a client parameter
1 parent e033d62 commit 86c033a

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

doc/changelog.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
Changelog
22
=========
33

4+
[0.4.4] - Unreleased
5+
--------------------
6+
7+
Added
8+
^^^^^
9+
- :class:`~scim2_client.engines.werkzeug.TestSCIMClient` can take a `client` parameter.
10+
411
[0.4.3] - 2024-12-06
512
--------------------
613

14+
Added
15+
^^^^^
716
- Add :paramref:`~scim2_client.SCIMClient.check_response_content_type` and
817
:paramref:`~scim2_client.SCIMClient.check_response_status_codes` parameters.
918

scim2_client/engines/werkzeug.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class TestSCIMClient(BaseSyncSCIMClient):
3737
This client avoids to perform real HTTP requests and directly execute the server code instead.
3838
This allows to dynamically catch the exceptions if something gets wrong.
3939
40-
:param client: A WSGI application instance that will be used to send requests.
40+
:param app: A WSGI application instance that will be used to send requests.
41+
:param client: An optional custom :class:`Werkzeug test Client <werkzeug.test.Client>`.
42+
If :data:`None` a default client is initialized.
4143
:param scim_prefix: The scim root endpoint in the application.
4244
:param resource_models: A tuple of :class:`~scim2_models.Resource` types expected to be handled by the SCIM client.
4345
If a request payload describe a resource that is not in this list, an exception will be raised.
@@ -66,9 +68,16 @@ class TestSCIMClient(BaseSyncSCIMClient):
6668
# avoid making Pytest believe this is a test class
6769
__test__ = False
6870

69-
def __init__(self, app, *args, scim_prefix: str = "", **kwargs):
71+
def __init__(
72+
self,
73+
app,
74+
client: Optional[Client] = None,
75+
*args,
76+
scim_prefix: str = "",
77+
**kwargs,
78+
):
7079
super().__init__(*args, **kwargs)
71-
self.client = Client(app)
80+
self.client = client or Client(app)
7281
self.scim_prefix = scim_prefix
7382

7483
def make_url(self, url: Optional[str]) -> str:

0 commit comments

Comments
 (0)