pytest-clerk 1.0.0__tar.gz → 1.1.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytest-clerk
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: A set of pytest fixtures to help with integration testing with Clerk.
5
5
  Home-page: https://gitlab.com/munipal-oss/pytest-clerk
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pytest-clerk"
3
- version = "1.0.0"
3
+ version = "1.1.0"
4
4
  description = "A set of pytest fixtures to help with integration testing with Clerk."
5
5
  authors = ["Ryan Causey <ryan.causey@munipal.io>"]
6
6
  license = "MIT"
@@ -20,7 +20,7 @@ pytest-aws-fixtures = {version = "^1.2.0", optional = true}
20
20
 
21
21
  [tool.poetry.group.dev.dependencies]
22
22
  prospector = "^1.10.2"
23
- black = "^23.3.0"
23
+ black = "^24.0.0"
24
24
  isort = "^5.12.0"
25
25
  pre-commit = "^3.7.0"
26
26
 
@@ -105,7 +105,7 @@ def clerk_frontend_httpx_client(clerk_frontend_api_url):
105
105
 
106
106
  client = httpx.Client(
107
107
  params={"__dev_session": result.json()["token"]},
108
- base_url=clerk_frontend_api_url,
108
+ base_url=f"{clerk_frontend_api_url}/v1",
109
109
  )
110
110
 
111
111
  yield client
@@ -183,6 +183,39 @@ def clerk_create_org(clerk_backend_httpx_client, clerk_delete_org):
183
183
  clerk_delete_org(org_id=org["id"])
184
184
 
185
185
 
186
+ @pytest.fixture
187
+ def clerk_update_org(clerk_backend_httpx_client):
188
+ """This fixture provides a function to update an organization with the provided
189
+ `organization_data`. All additional kwargs are passed through to the
190
+ httpx.Client.patch call.
191
+
192
+ The API documentation for this call can be found below:
193
+ https://clerk.com/docs/reference/backend-api/tag/Organizations#operation/UpdateOrganization
194
+ """
195
+
196
+ @retry(
197
+ retry=retry_if_exception(predicate=retry_predicate),
198
+ wait=wait_random_exponential(multiplier=0.5, max=60),
199
+ )
200
+ def _inner(org_id_or_slug, organization_data, **kwargs):
201
+ """This function attempts to update an organization with the provided
202
+ `organization_data`. All additional kwargs are passed through to the
203
+ httpx.Client.patch call.
204
+
205
+ This will retry rate limit errors.
206
+
207
+ The API documentation for this call can be found below:
208
+ https://clerk.com/docs/reference/backend-api/tag/Organizations#operation/UpdateOrganization
209
+ """
210
+ result = clerk_backend_httpx_client.patch(
211
+ url=f"/organizations/{org_id_or_slug}", json=organization_data, **kwargs
212
+ )
213
+ result.raise_for_status()
214
+ return result.json()
215
+
216
+ yield _inner
217
+
218
+
186
219
  @pytest.fixture
187
220
  def clerk_get_org(clerk_backend_httpx_client):
188
221
  """This fixture provides a function to get an organization by its ID or slug. All
@@ -364,7 +397,7 @@ def clerk_touch_user_session(clerk_frontend_httpx_client):
364
397
  retry=retry_if_exception(predicate=retry_predicate),
365
398
  wait=wait_random_exponential(multiplier=0.5, max=60),
366
399
  )
367
- def _inner(session_id, session_data, **kwargs):
400
+ def _inner(session_id, session_data=None, **kwargs):
368
401
  """Given a Clerk user session ID and any optional session_data, touch the
369
402
  session with the given ID with any session_data sent as form data. This passes
370
403
  through any additional kwargs to the httpx.Client.post call.
File without changes
File without changes