mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-07-09 16:09:13 +00:00
Fix workflow list query alias (SKY-12016) (#7206)
This commit is contained in:
parent
78fa30ed11
commit
1eb2e64f03
13 changed files with 574 additions and 12 deletions
|
|
@ -335,6 +335,36 @@ class TestBrowserCommands:
|
|||
|
||||
|
||||
class TestWorkflowCommands:
|
||||
def test_workflow_list_query_alias_maps_to_search(self, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
from skyvern.cli import workflow as workflow_cmd
|
||||
|
||||
monkeypatch.setattr(workflow_cmd, "prepare_cli_runtime", lambda **_: None)
|
||||
tool = AsyncMock(
|
||||
return_value={
|
||||
"ok": True,
|
||||
"action": "skyvern_workflow_list",
|
||||
"browser_context": {"mode": "none", "session_id": None, "cdp_url": None},
|
||||
"data": {"workflows": [], "page": 1, "page_size": 10, "count": 0, "has_more": False},
|
||||
"artifacts": [],
|
||||
"timing_ms": {},
|
||||
"warnings": [],
|
||||
"error": None,
|
||||
}
|
||||
)
|
||||
monkeypatch.setattr(workflow_cmd, "tool_workflow_list", tool)
|
||||
|
||||
result = CliRunner().invoke(workflow_cmd.workflow_app, ["list", "--query", "invoice", "--json"])
|
||||
|
||||
assert result.exit_code == 0, result.output
|
||||
assert tool.await_args.kwargs == {
|
||||
"search": "invoice",
|
||||
"page": 1,
|
||||
"page_size": 10,
|
||||
"only_workflows": False,
|
||||
}
|
||||
parsed = json.loads(result.output)
|
||||
assert parsed["ok"] is True
|
||||
|
||||
def test_workflow_get_outputs_mcp_envelope_in_json_mode(
|
||||
self, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture
|
||||
) -> None:
|
||||
|
|
|
|||
|
|
@ -136,6 +136,33 @@ async def test_list_includes_search_key_only_when_search_is_present(monkeypatch:
|
|||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_accepts_query_alias_for_search(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
request_mock = _patch_skyvern_list_response(monkeypatch, payload=[])
|
||||
|
||||
result = await mcp_workflow.skyvern_workflow_list(query="invoice", page=2, page_size=5)
|
||||
|
||||
assert result["ok"] is True, result
|
||||
params = request_mock.await_args.kwargs["params"]
|
||||
assert params == {
|
||||
"search_key": "invoice",
|
||||
"page": 2,
|
||||
"page_size": 5,
|
||||
"only_workflows": False,
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_rejects_conflicting_search_and_query(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
request_mock = _patch_skyvern_list_response(monkeypatch, payload=[])
|
||||
|
||||
result = await mcp_workflow.skyvern_workflow_list(search="invoice", query="receipt")
|
||||
|
||||
assert result["ok"] is False
|
||||
assert result["error"]["code"] == "INVALID_INPUT"
|
||||
request_mock.assert_not_awaited()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_raw_list_uses_fern_http_wrapper_auth_headers(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""The raw bypass still uses Fern's HTTP wrapper, including auth and query encoding."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue