Create a mock tool manager.
(mock_tool)
| 34 | |
| 35 | @pytest.fixture |
| 36 | def mock_tool_manager(mock_tool): |
| 37 | """Create a mock tool manager.""" |
| 38 | manager = AsyncMock() |
| 39 | |
| 40 | # Mock another tool without required params |
| 41 | another_tool = MagicMock() |
| 42 | another_tool.name = "another_tool" |
| 43 | another_tool.namespace = "another_server" |
| 44 | another_tool.fully_qualified_name = "another_server.another_tool" |
| 45 | another_tool.inputSchema = ( |
| 46 | None # Explicitly set to None to avoid MagicMock auto-creation |
| 47 | ) |
| 48 | another_tool.parameters = {} |
| 49 | |
| 50 | # Mock the async methods |
| 51 | manager.get_all_tools = AsyncMock(return_value=[mock_tool, another_tool]) |
| 52 | manager.execute_tool = AsyncMock( |
| 53 | return_value=ToolCallResult( |
| 54 | tool_name="test_tool", success=True, result="Tool executed successfully" |
| 55 | ) |
| 56 | ) |
| 57 | |
| 58 | # Add server_names as a regular dict, not AsyncMock |
| 59 | manager.server_names = {0: "test_server", 1: "another_server"} |
| 60 | |
| 61 | return manager |
| 62 | |
| 63 | |
| 64 | class TestExecuteToolCommand: |
nothing calls this directly
no test coverage detected