scim2-client 0.4.3__py3-none-any.whl → 0.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scim2_client/client.py +3 -1
- scim2_client/engines/werkzeug.py +29 -15
- {scim2_client-0.4.3.dist-info → scim2_client-0.5.1.dist-info}/METADATA +1 -1
- {scim2_client-0.4.3.dist-info → scim2_client-0.5.1.dist-info}/RECORD +6 -6
- {scim2_client-0.4.3.dist-info → scim2_client-0.5.1.dist-info}/WHEEL +0 -0
- {scim2_client-0.4.3.dist-info → scim2_client-0.5.1.dist-info}/licenses/LICENSE.md +0 -0
scim2_client/client.py
CHANGED
|
@@ -265,7 +265,6 @@ class SCIMClient:
|
|
|
265
265
|
if raise_scim_errors is None:
|
|
266
266
|
raise_scim_errors = self.raise_scim_errors
|
|
267
267
|
|
|
268
|
-
self._check_status_codes(status_code, expected_status_codes)
|
|
269
268
|
self._check_content_types(headers)
|
|
270
269
|
|
|
271
270
|
# In addition to returning an HTTP response code, implementers MUST return
|
|
@@ -283,6 +282,7 @@ class SCIMClient:
|
|
|
283
282
|
check_response_payload = self.check_response_payload
|
|
284
283
|
|
|
285
284
|
if not check_response_payload:
|
|
285
|
+
self._check_status_codes(status_code, expected_status_codes)
|
|
286
286
|
return response_payload
|
|
287
287
|
|
|
288
288
|
if (
|
|
@@ -294,6 +294,8 @@ class SCIMClient:
|
|
|
294
294
|
raise SCIMResponseErrorObject(obj=error.detail, source=error)
|
|
295
295
|
return error
|
|
296
296
|
|
|
297
|
+
self._check_status_codes(status_code, expected_status_codes)
|
|
298
|
+
|
|
297
299
|
if not expected_types:
|
|
298
300
|
return response_payload
|
|
299
301
|
|
scim2_client/engines/werkzeug.py
CHANGED
|
@@ -37,8 +37,10 @@ class TestSCIMClient(BaseSyncSCIMClient):
|
|
|
37
37
|
This client avoids to perform real HTTP requests and directly execute the server code instead.
|
|
38
38
|
This allows to dynamically catch the exceptions if something gets wrong.
|
|
39
39
|
|
|
40
|
-
:param client:
|
|
40
|
+
:param client: An optional custom :class:`Werkzeug test Client <werkzeug.test.Client>`.
|
|
41
|
+
If :data:`None` a default client is initialized.
|
|
41
42
|
:param scim_prefix: The scim root endpoint in the application.
|
|
43
|
+
:param environ: Additional parameters that will be passed to every request.
|
|
42
44
|
:param resource_models: A tuple of :class:`~scim2_models.Resource` types expected to be handled by the SCIM client.
|
|
43
45
|
If a request payload describe a resource that is not in this list, an exception will be raised.
|
|
44
46
|
:param check_request_payload: If :data:`False`,
|
|
@@ -54,9 +56,14 @@ class TestSCIMClient(BaseSyncSCIMClient):
|
|
|
54
56
|
|
|
55
57
|
from scim2_client.engines.werkzeug import TestSCIMClient
|
|
56
58
|
from scim2_models import User, Group
|
|
59
|
+
from werkzeug.test import Client
|
|
57
60
|
|
|
58
61
|
scim_provider = myapp.create_app()
|
|
59
|
-
testclient = TestSCIMClient(
|
|
62
|
+
testclient = TestSCIMClient(
|
|
63
|
+
app=Client(scim_provider),
|
|
64
|
+
environ={"base_url": "/scim/v2"},
|
|
65
|
+
resource_models=(User, Group),
|
|
66
|
+
)
|
|
60
67
|
|
|
61
68
|
request_user = User(user_name="foo", display_name="bar")
|
|
62
69
|
response_user = scim_client.create(request_user)
|
|
@@ -66,10 +73,18 @@ class TestSCIMClient(BaseSyncSCIMClient):
|
|
|
66
73
|
# avoid making Pytest believe this is a test class
|
|
67
74
|
__test__ = False
|
|
68
75
|
|
|
69
|
-
def __init__(
|
|
76
|
+
def __init__(
|
|
77
|
+
self,
|
|
78
|
+
client: Client,
|
|
79
|
+
environ: Optional[dict] = None,
|
|
80
|
+
scim_prefix: str = "",
|
|
81
|
+
*args,
|
|
82
|
+
**kwargs,
|
|
83
|
+
):
|
|
70
84
|
super().__init__(*args, **kwargs)
|
|
71
|
-
self.client =
|
|
85
|
+
self.client = client
|
|
72
86
|
self.scim_prefix = scim_prefix
|
|
87
|
+
self.environ = environ or {}
|
|
73
88
|
|
|
74
89
|
def make_url(self, url: Optional[str]) -> str:
|
|
75
90
|
url = url or ""
|
|
@@ -103,9 +118,8 @@ class TestSCIMClient(BaseSyncSCIMClient):
|
|
|
103
118
|
**kwargs,
|
|
104
119
|
)
|
|
105
120
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
)
|
|
121
|
+
environ = {**self.environ, **req.request_kwargs}
|
|
122
|
+
response = self.client.post(self.make_url(req.url), json=req.payload, **environ)
|
|
109
123
|
|
|
110
124
|
with handle_response_error(req.payload):
|
|
111
125
|
return self.check_response(
|
|
@@ -143,8 +157,9 @@ class TestSCIMClient(BaseSyncSCIMClient):
|
|
|
143
157
|
)
|
|
144
158
|
|
|
145
159
|
query_string = urlencode(req.payload, doseq=False) if req.payload else None
|
|
160
|
+
environ = {**self.environ, **req.request_kwargs}
|
|
146
161
|
response = self.client.get(
|
|
147
|
-
self.make_url(req.url), query_string=query_string, **
|
|
162
|
+
self.make_url(req.url), query_string=query_string, **environ
|
|
148
163
|
)
|
|
149
164
|
|
|
150
165
|
with handle_response_error(req.payload):
|
|
@@ -178,9 +193,8 @@ class TestSCIMClient(BaseSyncSCIMClient):
|
|
|
178
193
|
**kwargs,
|
|
179
194
|
)
|
|
180
195
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
)
|
|
196
|
+
environ = {**self.environ, **req.request_kwargs}
|
|
197
|
+
response = self.client.post(self.make_url(req.url), json=req.payload, **environ)
|
|
184
198
|
|
|
185
199
|
with handle_response_error(response):
|
|
186
200
|
return self.check_response(
|
|
@@ -213,7 +227,8 @@ class TestSCIMClient(BaseSyncSCIMClient):
|
|
|
213
227
|
**kwargs,
|
|
214
228
|
)
|
|
215
229
|
|
|
216
|
-
|
|
230
|
+
environ = {**self.environ, **req.request_kwargs}
|
|
231
|
+
response = self.client.delete(self.make_url(req.url), **environ)
|
|
217
232
|
|
|
218
233
|
with handle_response_error(response):
|
|
219
234
|
return self.check_response(
|
|
@@ -244,9 +259,8 @@ class TestSCIMClient(BaseSyncSCIMClient):
|
|
|
244
259
|
**kwargs,
|
|
245
260
|
)
|
|
246
261
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
)
|
|
262
|
+
environ = {**self.environ, **req.request_kwargs}
|
|
263
|
+
response = self.client.put(self.make_url(req.url), json=req.payload, **environ)
|
|
250
264
|
|
|
251
265
|
with handle_response_error(response):
|
|
252
266
|
return self.check_response(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: scim2-client
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: Pythonically build SCIM requests and parse SCIM responses
|
|
5
5
|
Project-URL: documentation, https://scim2-client.readthedocs.io
|
|
6
6
|
Project-URL: repository, https://github.com/python-scim/scim2-client
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
scim2_client/__init__.py,sha256=l0pyBLiTpFA68ao98PqQLT_Xx0mw8BHumwrIHYCWa_M,845
|
|
2
|
-
scim2_client/client.py,sha256=
|
|
2
|
+
scim2_client/client.py,sha256=Ti7LNwCSa_98GK6_LkG-X0GFMf5HQ1KQ4gOubUc16to,46367
|
|
3
3
|
scim2_client/errors.py,sha256=FVmRXsaZLn1VZhJ3dSDs4IqycuU92AEun9JWWMseVO8,4397
|
|
4
4
|
scim2_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
scim2_client/engines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
scim2_client/engines/httpx.py,sha256=L39ZZHjqe43uIQpgh_r_maqM2gkf3_Rk6d8MeNe57gk,17781
|
|
7
|
-
scim2_client/engines/werkzeug.py,sha256=
|
|
8
|
-
scim2_client-0.
|
|
9
|
-
scim2_client-0.
|
|
10
|
-
scim2_client-0.
|
|
11
|
-
scim2_client-0.
|
|
7
|
+
scim2_client/engines/werkzeug.py,sha256=DmUBWytoWPehcrgBpGzlRJLCT7mrAW_VWSQ6BHylwCo,10800
|
|
8
|
+
scim2_client-0.5.1.dist-info/METADATA,sha256=eJVaMV-MJtKvkH3V9LyPw8hpMy_6-1W_tKCOpLFtP3A,16961
|
|
9
|
+
scim2_client-0.5.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
10
|
+
scim2_client-0.5.1.dist-info/licenses/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
11
|
+
scim2_client-0.5.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|