feat(api): Expand API hooks with drag and right_click actions

This commit is contained in:
2026-05-12 19:06:54 -04:00
parent d92361b025
commit a3b117dabd
4 changed files with 72 additions and 2 deletions
+26 -1
View File
@@ -81,4 +81,29 @@ def test_get_node_status() -> None:
}
status = client.get_node_status("T1")
assert status["status"] == "todo"
mock_make.assert_any_call('GET', '/api/mma/node/T1')
mock_make.assert_any_call('GET', '/api/mma/node/T1')
def test_drag_success() -> None:
"""Test that drag correctly sends a POST request to the /api/gui endpoint."""
client = ApiHookClient()
with patch.object(client, '_make_request') as mock_make:
mock_make.return_value = {"status": "queued"}
res = client.drag("src_id", "dst_id")
assert res["status"] == "queued"
mock_make.assert_any_call('POST', '/api/gui', data={
"action": "drag",
"src_item": "src_id",
"dst_item": "dst_id"
})
def test_right_click_success() -> None:
"""Test that right_click correctly sends a POST request to the /api/gui endpoint."""
client = ApiHookClient()
with patch.object(client, '_make_request') as mock_make:
mock_make.return_value = {"status": "queued"}
res = client.right_click("item_id")
assert res["status"] == "queued"
mock_make.assert_any_call('POST', '/api/gui', data={
"action": "right_click",
"item": "item_id"
})