Private
Public Access
test(gui2_mcp): migrate to send_result() (Phase 2.5)
The test_mcp_tool_call_is_dispatched test calls ai_client.send() and asserts the MCP dispatch function was called. Migrating to send_result() + assert result.ok. Changes: - Rename ai_client.send(...) to ai_client.send_result(...) - Add assert result.ok - Add "from src.result_types import Result" import 1 test passes.
This commit is contained in:
@@ -2,6 +2,7 @@ import unittest.mock
|
||||
from unittest.mock import patch, MagicMock
|
||||
from src.gui_2 import App
|
||||
from src import ai_client
|
||||
from src.result_types import Result
|
||||
|
||||
def test_mcp_tool_call_is_dispatched(app_instance: App) -> None:
|
||||
"""
|
||||
@@ -44,12 +45,13 @@ def test_mcp_tool_call_is_dispatched(app_instance: App) -> None:
|
||||
mock_chat.send_message.side_effect = [mock_response_with_tool, mock_response_final]
|
||||
ai_client.set_provider("gemini", "mock-model")
|
||||
# 5. Call the send function
|
||||
ai_client.send(
|
||||
result = ai_client.send_result(
|
||||
md_content="some context",
|
||||
user_message="read the file",
|
||||
base_dir=".",
|
||||
file_items=[],
|
||||
discussion_history=""
|
||||
)
|
||||
assert result.ok
|
||||
# 6. Assert that the MCP dispatch function was called
|
||||
mock_dispatch.assert_called_once_with("read_file", {"file_path": "test.txt"})
|
||||
Reference in New Issue
Block a user