mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-17 00:20:51 +00:00
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 <noreply@anthropic.com> * chore: point get_resume_urls at get_approval_urls' rationale Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
465446e1ba
commit
bbb48f5a61
@@ -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
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user