Skip to content

Commit 2f41d4f

Browse files
sdk-python: update v2 client and tests
1 parent 0b97542 commit 2f41d4f

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/durable_workflow/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ async def signal_workflow(
266266
) -> None:
267267
body: dict[str, Any] = {}
268268
if args:
269-
body["input"] = args
269+
body["input"] = serializer.envelope(args)
270270
await self._request("POST", f"/workflows/{workflow_id}/signal/{signal_name}", json=body, context=workflow_id)
271271

272272
async def query_workflow(
273273
self, workflow_id: str, query_name: str, *, args: list[Any] | None = None
274274
) -> Any:
275275
body: dict[str, Any] = {}
276276
if args:
277-
body["input"] = args
277+
body["input"] = serializer.envelope(args)
278278
return await self._request(
279279
"POST", f"/workflows/{workflow_id}/query/{query_name}", json=body, context=workflow_id
280280
)
@@ -303,7 +303,7 @@ async def update_workflow(
303303
) -> Any:
304304
body: dict[str, Any] = {}
305305
if args:
306-
body["input"] = args
306+
body["input"] = serializer.envelope(args)
307307
if wait_for is not None:
308308
body["wait_for"] = wait_for
309309
if wait_timeout_seconds is not None:

tests/test_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ async def test_signal(self, client: Client) -> None:
142142
call_args = mock.call_args
143143
assert "/signal/my-signal" in call_args[0][1]
144144
body = call_args.kwargs.get("json") or call_args[1].get("json")
145-
assert body["input"] == ["data"]
145+
assert body["input"]["codec"] == "json"
146+
assert json.loads(body["input"]["blob"]) == ["data"]
146147

147148

148149
class TestCancelWorkflow:
@@ -302,7 +303,8 @@ async def test_update(self, client: Client) -> None:
302303
call_args = mock.call_args
303304
assert "/update/my-update" in call_args[0][1]
304305
body = call_args.kwargs.get("json") or call_args[1].get("json")
305-
assert body["input"] == ["data"]
306+
assert body["input"]["codec"] == "json"
307+
assert json.loads(body["input"]["blob"]) == ["data"]
306308
assert body["wait_for"] == "completed"
307309
assert body["wait_timeout_seconds"] == 10
308310

0 commit comments

Comments
 (0)