mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-08 18:57:52 +02:00
add test case
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user