add test case

This commit is contained in:
rafid saad
2026-02-02 17:34:38 -08:00
parent ca9b3c6ff6
commit 49299465c7
+27
View File
@@ -276,3 +276,30 @@ def test_sync_create_with_end_time():
)
assert result == cron
def test_sync_create_with_enabled():
"""Test that SyncCronClient.create includes enabled in the payload."""
cron = _cron_payload()
def handler(request: httpx.Request) -> httpx.Response:
assert request.method == "POST"
assert request.url.path == "/runs/crons"
body = json.loads(request.content)
assert body["schedule"] == "0 12 * * *"
assert body["assistant_id"] == "asst_456"
assert body["enabled"] == True
return httpx.Response(200, json=cron)
transport = httpx.MockTransport(handler)
with httpx.Client(transport=transport, base_url="https://example.com") as client:
http_client = SyncHttpClient(client)
cron_client = SyncCronClient(http_client)
result = cron_client.create(
assistant_id="asst_456",
schedule="0 12 * * *",
enabled=True,
)
assert result == cron