feat: add cap call rpc command
This commit is contained in:
@@ -327,6 +327,20 @@ def test_wf_cap_commands_use_rpc_url_override(monkeypatch, tmp_path) -> None:
|
||||
"100",
|
||||
],
|
||||
)
|
||||
called = runner.invoke(
|
||||
app,
|
||||
[
|
||||
"--config",
|
||||
str(config_path),
|
||||
"--url",
|
||||
"http://test/rpc",
|
||||
"cap",
|
||||
"call",
|
||||
"wf.std.constant",
|
||||
"--input",
|
||||
'{"value": "hello cap call"}',
|
||||
],
|
||||
)
|
||||
|
||||
assert inspected.exit_code == 0, inspected.output
|
||||
assert '"name": "wf.std.constant"' in inspected.output
|
||||
@@ -336,6 +350,11 @@ def test_wf_cap_commands_use_rpc_url_override(monkeypatch, tmp_path) -> None:
|
||||
assert {
|
||||
capability["source_id"] for capability in listed_payload["capabilities"]
|
||||
} == {"wf.std"}
|
||||
assert called.exit_code == 0, called.output
|
||||
called_payload = json.loads(called.output)
|
||||
assert called_payload["qualified_name"] == "wf.std.constant"
|
||||
assert called_payload["outcome"] == "ok"
|
||||
assert called_payload["output"] == {"value": "hello cap call"}
|
||||
|
||||
|
||||
def test_wf_source_commands_use_rpc_url_override(monkeypatch, tmp_path) -> None:
|
||||
|
||||
@@ -38,6 +38,14 @@ async def test_rpc_health_and_capability_methods(tmp_path) -> None:
|
||||
"workflow.capabilities.inspect",
|
||||
{"qualified_name": "wf.std.constant"},
|
||||
)
|
||||
called = await _rpc(
|
||||
client,
|
||||
"workflow.capabilities.call",
|
||||
{
|
||||
"qualified_name": "wf.std.constant",
|
||||
"payload": {"value": "hello direct rpc"},
|
||||
},
|
||||
)
|
||||
|
||||
assert health_response.status_code == 200
|
||||
assert health_response.json()["status"] == "ok"
|
||||
@@ -47,6 +55,10 @@ async def test_rpc_health_and_capability_methods(tmp_path) -> None:
|
||||
capability["source_id"] for capability in listed["result"]["capabilities"]
|
||||
} == {"wf.std"}
|
||||
assert inspected["result"]["name"] == "wf.std.constant"
|
||||
assert called["result"]["qualified_name"] == "wf.std.constant"
|
||||
assert called["result"]["kind"] == "node_spec"
|
||||
assert called["result"]["outcome"] == "ok"
|
||||
assert called["result"]["output"] == {"value": "hello direct rpc"}
|
||||
|
||||
|
||||
async def test_rpc_unknown_method_returns_json_rpc_error(tmp_path) -> None:
|
||||
|
||||
@@ -71,12 +71,19 @@ async def test_rpc_workflow_client_lists_and_inspects_capabilities(tmp_path) ->
|
||||
)
|
||||
listed = await client.list_capabilities(source_id="wf.std", limit=5)
|
||||
inspected = await client.inspect_capability(qualified_name="wf.std.constant")
|
||||
called = await client.call_capability(
|
||||
qualified_name="wf.std.constant",
|
||||
payload={"value": "hello rpc client"},
|
||||
)
|
||||
|
||||
assert listed["capabilities"]
|
||||
assert {capability["source_id"] for capability in listed["capabilities"]} == {
|
||||
"wf.std"
|
||||
}
|
||||
assert inspected["name"] == "wf.std.constant"
|
||||
assert called["qualified_name"] == "wf.std.constant"
|
||||
assert called["outcome"] == "ok"
|
||||
assert called["output"] == {"value": "hello rpc client"}
|
||||
|
||||
|
||||
async def test_rpc_workflow_client_lists_and_inspects_sources(tmp_path) -> None:
|
||||
|
||||
Reference in New Issue
Block a user