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
+21 -1
View File
@@ -1,6 +1,6 @@
from typing import Generator
import pytest
from unittest.mock import patch
from unittest.mock import patch, Mock
from src import ai_client
from src.gui_2 import App
@@ -46,3 +46,23 @@ def test_gcli_path_updates_adapter(app_instance: App) -> None:
app_instance.controller._process_pending_gui_tasks()
assert ai_client._gemini_cli_adapter is not None
assert ai_client._gemini_cli_adapter.binary_path == '/new/path/to/gemini'
def test_process_pending_gui_tasks_drag(app_instance: App) -> None:
"""Test that the drag action is correctly processed and dispatches to the registered callback."""
mock_callback = Mock()
app_instance.controller._drag_actions["src_id"] = mock_callback
app_instance.controller._pending_gui_tasks = [
{"action": "drag", "src_item": "src_id", "dst_item": "dst_id"}
]
app_instance.controller._process_pending_gui_tasks()
mock_callback.assert_called_once_with(dst_item="dst_id")
def test_process_pending_gui_tasks_right_click(app_instance: App) -> None:
"""Test that the right_click action is correctly processed and dispatches to the registered callback."""
mock_callback = Mock()
app_instance.controller._right_clickable_actions["item_id"] = mock_callback
app_instance.controller._pending_gui_tasks = [
{"action": "right_click", "item": "item_id"}
]
app_instance.controller._process_pending_gui_tasks()
mock_callback.assert_called_once()