test: Update tests to mock async_dispatch for asynchronous tool execution engine.

This commit is contained in:
2026-03-06 13:26:32 -05:00
parent eddc24503d
commit 3bc900b760
2 changed files with 4 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
import unittest.mock
from unittest.mock import patch, MagicMock
from src import ai_client
@@ -55,7 +56,7 @@ def test_deepseek_tool_calling(mock_post: MagicMock) -> None:
"""
ai_client.set_provider("deepseek", "deepseek-chat")
with patch("src.ai_client._load_credentials", return_value={"deepseek": {"api_key": "test-key"}}), \
patch("src.mcp_client.dispatch") as mock_dispatch:
patch("src.mcp_client.async_dispatch", new_callable=unittest.mock.AsyncMock) as mock_dispatch:
# Round 1: Model calls a tool
mock_resp1 = MagicMock()