pytest-clerk 4.0.4__tar.gz → 4.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.
- {pytest_clerk-4.0.4 → pytest_clerk-4.1.0}/PKG-INFO +1 -1
- {pytest_clerk-4.0.4 → pytest_clerk-4.1.0}/pyproject.toml +1 -1
- {pytest_clerk-4.0.4 → pytest_clerk-4.1.0}/pytest_clerk/clerk.py +45 -2
- {pytest_clerk-4.0.4 → pytest_clerk-4.1.0}/LICENSE +0 -0
- {pytest_clerk-4.0.4 → pytest_clerk-4.1.0}/README.md +0 -0
- {pytest_clerk-4.0.4 → pytest_clerk-4.1.0}/pytest_clerk/__init__.py +0 -0
|
@@ -291,9 +291,14 @@ def clerk_delete_org(clerk_backend_httpx_client):
|
|
|
291
291
|
The API documentation for this call can be found below:
|
|
292
292
|
https://clerk.com/docs/reference/backend-api/tag/Organizations#operation/DeleteOrganization
|
|
293
293
|
"""
|
|
294
|
-
|
|
294
|
+
result = clerk_backend_httpx_client.delete(
|
|
295
295
|
url=f"/organizations/{org_id}", **kwargs
|
|
296
296
|
)
|
|
297
|
+
# Ignore 404 errors indicating it was already deleted. Raise other errors.
|
|
298
|
+
if result.status_code != httpx.codes.NOT_FOUND:
|
|
299
|
+
result.raise_for_status()
|
|
300
|
+
|
|
301
|
+
return result
|
|
297
302
|
|
|
298
303
|
return _inner
|
|
299
304
|
|
|
@@ -427,7 +432,12 @@ def clerk_delete_user(clerk_backend_httpx_client):
|
|
|
427
432
|
The API documentation for this call can be found below:
|
|
428
433
|
https://clerk.com/docs/reference/backend-api/tag/Users#operation/DeleteUser
|
|
429
434
|
"""
|
|
430
|
-
|
|
435
|
+
result = clerk_backend_httpx_client.delete(url=f"/users/{user_id}", **kwargs)
|
|
436
|
+
# Ignore 404 errors indicating it was already deleted. Raise other errors.
|
|
437
|
+
if result.status_code != httpx.codes.NOT_FOUND:
|
|
438
|
+
result.raise_for_status()
|
|
439
|
+
|
|
440
|
+
return result
|
|
431
441
|
|
|
432
442
|
return _inner
|
|
433
443
|
|
|
@@ -470,6 +480,39 @@ def clerk_create_user(clerk_backend_httpx_client, clerk_delete_user):
|
|
|
470
480
|
clerk_delete_user(user_id=user["id"])
|
|
471
481
|
|
|
472
482
|
|
|
483
|
+
@pytest.fixture
|
|
484
|
+
def clerk_update_user_metadata(clerk_backend_httpx_client):
|
|
485
|
+
"""This fixture provides a function to update a user's metadata given the user ID.
|
|
486
|
+
All additional kwargs are passed through to the httpx.Client.patch call.
|
|
487
|
+
|
|
488
|
+
The API documentation for this call can be found below:
|
|
489
|
+
https://clerk.com/docs/reference/backend-api/tag/users/patch/users/%7Buser_id%7D/metadata
|
|
490
|
+
"""
|
|
491
|
+
|
|
492
|
+
@retry(
|
|
493
|
+
stop=stop_after_attempt(10),
|
|
494
|
+
wait=wait_random_exponential(multiplier=0.5, max=60),
|
|
495
|
+
reraise=True,
|
|
496
|
+
)
|
|
497
|
+
def _inner(user_id, metadata, **kwargs):
|
|
498
|
+
"""Update the metadata of the user with the given user ID. All additional kwargs
|
|
499
|
+
are passed through to the httpx.Client.patch call.
|
|
500
|
+
|
|
501
|
+
This will retry rate limit errors.
|
|
502
|
+
|
|
503
|
+
The API documentation for this call can be found below:
|
|
504
|
+
https://clerk.com/docs/reference/backend-api/tag/users/patch/users/%7Buser_id%7D/metadata
|
|
505
|
+
"""
|
|
506
|
+
result = clerk_backend_httpx_client.patch(
|
|
507
|
+
url=f"/users/{user_id}/metadata", json=metadata, **kwargs
|
|
508
|
+
)
|
|
509
|
+
result.raise_for_status()
|
|
510
|
+
|
|
511
|
+
return result.json()
|
|
512
|
+
|
|
513
|
+
return _inner
|
|
514
|
+
|
|
515
|
+
|
|
473
516
|
@pytest.fixture
|
|
474
517
|
def clerk_add_org_member(clerk_backend_httpx_client):
|
|
475
518
|
"""This fixture provides a function to add a user to an organization. All additional
|
|
File without changes
|
|
File without changes
|
|
File without changes
|