Skip to content

Commit c647324

Browse files
moar
1 parent 7aa9142 commit c647324

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

tests/test_audit_logs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ def test_auto_generates_idempotency_key(
126126
assert "idempotency-key" in request_kwargs["headers"]
127127
idempotency_key = request_kwargs["headers"]["idempotency-key"]
128128
assert idempotency_key and idempotency_key.strip()
129+
# Assert the auto-generated key has the correct prefix
130+
assert idempotency_key.startswith("workos-python-")
131+
# Assert the key has the expected UUID format after the prefix
132+
assert len(idempotency_key) > len("workos-python-")
129133
assert response is None
130134

131135
def test_throws_unauthorized_exception(

workos/audit_logs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def create_event(
8686
headers = {}
8787
# Auto-generate UUID v4 if not provided
8888
if idempotency_key is None:
89-
idempotency_key = str(uuid.uuid4())
89+
idempotency_key = f"workos-python-{uuid.uuid4()}"
9090

9191
headers["idempotency-key"] = idempotency_key
9292

0 commit comments

Comments
 (0)