From bbb48f5a61c9d23ba541fdcfa3d198a72937d71f Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sun, 15 Nov 2026 13:45:01 +0100 Subject: [PATCH] fix(python-client): omit approver from get_resume_urls when not given (#12446) * fix(python-client): omit approver from get_resume_urls when not given With approver=None httpx sends `?approver=`, which the server records as an empty approver instead of falling back to "anonymous". get_approval_urls already omits it. Co-Authored-By: Claude Opus 5.5 * chore: point get_resume_urls at get_approval_urls' rationale Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- python-client/wmill/tests/test_resume_urls.py | 33 +++++++++++++++++++ python-client/wmill/wmill/client.py | 3 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 python-client/wmill/tests/test_resume_urls.py diff --git a/python-client/wmill/tests/test_resume_urls.py b/python-client/wmill/tests/test_resume_urls.py new file mode 100644 index 0000000000..9ed5152185 --- /dev/null +++ b/python-client/wmill/tests/test_resume_urls.py @@ -0,0 +1,33 @@ +"""The query string get_resume_urls sends, as httpx serialises it.""" + +import httpx +import pytest + +from wmill.client import Windmill + + +def _sent_query(**kwargs) -> dict: + sent = [] + + def handler(request: httpx.Request) -> httpx.Response: + sent.append(dict(request.url.params)) + return httpx.Response(200, json={}) + + client = Windmill(base_url="http://wm.test", token="t", workspace="ws") + client.client = httpx.Client( + base_url=client.base_url, transport=httpx.MockTransport(handler) + ) + client.get_resume_urls(**kwargs) + return sent[0] + + +@pytest.mark.parametrize( + "kwargs, expected", + [ + ({}, {}), + ({"flow_level": True}, {"flow_level": "true"}), + ({"approver": "alice"}, {"approver": "alice"}), + ], +) +def test_get_resume_urls_query(kwargs, expected): + assert _sent_query(**kwargs) == expected diff --git a/python-client/wmill/wmill/client.py b/python-client/wmill/wmill/client.py index aeccdd1959..d9af5b03b8 100644 --- a/python-client/wmill/wmill/client.py +++ b/python-client/wmill/wmill/client.py @@ -1432,7 +1432,8 @@ class Windmill: """ nonce = random.randint(0, 1000000000) job_id = os.environ.get("WM_JOB_ID") or "NO_ID" - params = {"approver": approver} + # See get_approval_urls for why an absent approver is omitted. + params = {"approver": approver} if approver is not None else {} if flow_level is not None: params["flow_level"] = flow_level return self.get(