Skip to content

Commit 3af66c5

Browse files
Assert Python schedule control-plane parity
Assert Python schedule control parity
1 parent 200a319 commit 3af66c5

4 files changed

Lines changed: 154 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"schema": "durable-workflow.polyglot.control-plane-request-fixture",
3+
"version": 1,
4+
"operation": "schedule.delete",
5+
"request": {
6+
"method": "DELETE",
7+
"path": "/schedules/inventory-refresh"
8+
},
9+
"semantic_body": {
10+
"namespace": "orders-prod",
11+
"schedule_id": "inventory-refresh",
12+
"outcome": "deleted"
13+
},
14+
"response_body": {
15+
"namespace": "orders-prod",
16+
"schedule_id": "inventory-refresh",
17+
"outcome": "deleted",
18+
"deleted_at": "2026-04-22T07:30:00Z"
19+
},
20+
"cli": {
21+
"argv": {
22+
"schedule-id": "inventory-refresh",
23+
"--json": true
24+
}
25+
},
26+
"sdk_python": {
27+
"method": "delete_schedule",
28+
"args": {
29+
"schedule_id": "inventory-refresh"
30+
}
31+
}
32+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"schema": "durable-workflow.polyglot.control-plane-request-fixture",
3+
"version": 1,
4+
"operation": "schedule.pause",
5+
"request": {
6+
"method": "POST",
7+
"path": "/schedules/daily-order-rollup/pause",
8+
"body": {
9+
"note": "operator maintenance window"
10+
}
11+
},
12+
"semantic_body": {
13+
"namespace": "orders-prod",
14+
"schedule_id": "daily-order-rollup",
15+
"outcome": "paused",
16+
"note": "operator maintenance window"
17+
},
18+
"response_body": {
19+
"namespace": "orders-prod",
20+
"schedule_id": "daily-order-rollup",
21+
"outcome": "paused",
22+
"paused": true,
23+
"note": "operator maintenance window",
24+
"paused_at": "2026-04-22T07:00:00Z"
25+
},
26+
"cli": {
27+
"argv": {
28+
"schedule-id": "daily-order-rollup",
29+
"--note": "operator maintenance window",
30+
"--json": true
31+
}
32+
},
33+
"sdk_python": {
34+
"method": "pause_schedule",
35+
"args": {
36+
"schedule_id": "daily-order-rollup",
37+
"note": "operator maintenance window"
38+
}
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"schema": "durable-workflow.polyglot.control-plane-request-fixture",
3+
"version": 1,
4+
"operation": "schedule.resume",
5+
"request": {
6+
"method": "POST",
7+
"path": "/schedules/daily-order-rollup/resume",
8+
"body": {
9+
"note": "maintenance complete"
10+
}
11+
},
12+
"semantic_body": {
13+
"namespace": "orders-prod",
14+
"schedule_id": "daily-order-rollup",
15+
"outcome": "resumed",
16+
"note": "maintenance complete"
17+
},
18+
"response_body": {
19+
"namespace": "orders-prod",
20+
"schedule_id": "daily-order-rollup",
21+
"outcome": "resumed",
22+
"paused": false,
23+
"note": "maintenance complete",
24+
"resumed_at": "2026-04-22T07:15:00Z"
25+
},
26+
"cli": {
27+
"argv": {
28+
"schedule-id": "daily-order-rollup",
29+
"--note": "maintenance complete",
30+
"--json": true
31+
}
32+
},
33+
"sdk_python": {
34+
"method": "resume_schedule",
35+
"args": {
36+
"schedule_id": "daily-order-rollup",
37+
"note": "maintenance complete"
38+
}
39+
}
40+
}

tests/test_client.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,48 @@ async def test_describe_schedule_matches_polyglot_fixture(self, client: Client)
11111111
assert result.fires_count == semantic["fires_count"]
11121112
assert result.remaining_actions == semantic["remaining_actions"]
11131113

1114+
@pytest.mark.asyncio
1115+
async def test_pause_schedule_matches_polyglot_fixture(self, client: Client) -> None:
1116+
fixture_path = Path(__file__).parent / "fixtures" / "control-plane" / "schedule-pause-parity.json"
1117+
fixture = json.loads(fixture_path.read_text())
1118+
sdk = fixture["sdk_python"]
1119+
resp = _mock_response(200, fixture["response_body"])
1120+
1121+
with patch.object(client._http, "request", new_callable=AsyncMock, return_value=resp) as mock:
1122+
await client.pause_schedule(**sdk["args"])
1123+
1124+
assert mock.call_args.args[0] == fixture["request"]["method"]
1125+
assert mock.call_args.args[1] == f"/api{fixture['request']['path']}"
1126+
assert mock.call_args.kwargs["json"] == fixture["request"]["body"]
1127+
1128+
@pytest.mark.asyncio
1129+
async def test_resume_schedule_matches_polyglot_fixture(self, client: Client) -> None:
1130+
fixture_path = Path(__file__).parent / "fixtures" / "control-plane" / "schedule-resume-parity.json"
1131+
fixture = json.loads(fixture_path.read_text())
1132+
sdk = fixture["sdk_python"]
1133+
resp = _mock_response(200, fixture["response_body"])
1134+
1135+
with patch.object(client._http, "request", new_callable=AsyncMock, return_value=resp) as mock:
1136+
await client.resume_schedule(**sdk["args"])
1137+
1138+
assert mock.call_args.args[0] == fixture["request"]["method"]
1139+
assert mock.call_args.args[1] == f"/api{fixture['request']['path']}"
1140+
assert mock.call_args.kwargs["json"] == fixture["request"]["body"]
1141+
1142+
@pytest.mark.asyncio
1143+
async def test_delete_schedule_matches_polyglot_fixture(self, client: Client) -> None:
1144+
fixture_path = Path(__file__).parent / "fixtures" / "control-plane" / "schedule-delete-parity.json"
1145+
fixture = json.loads(fixture_path.read_text())
1146+
sdk = fixture["sdk_python"]
1147+
resp = _mock_response(200, fixture["response_body"])
1148+
1149+
with patch.object(client._http, "request", new_callable=AsyncMock, return_value=resp) as mock:
1150+
await client.delete_schedule(**sdk["args"])
1151+
1152+
assert mock.call_args.args[0] == fixture["request"]["method"]
1153+
assert mock.call_args.args[1] == f"/api{fixture['request']['path']}"
1154+
assert mock.call_args.kwargs.get("json") is None
1155+
11141156

11151157
class TestErrorMapping:
11161158
@pytest.mark.asyncio

0 commit comments

Comments
 (0)