1- from apps .tool_config_app import validate_tool
2- from consts .exceptions import MCPConnectionError , NotFoundException , ToolExecutionException
3- from consts .model import ToolInfo , ToolSourceEnum , ToolInstanceInfoRequest , ToolValidateRequest
41import asyncio
52import inspect
63import sys
2118 search_tool_info_impl ,
2219 update_tool_info_impl ,
2320 list_all_tools ,
24- load_last_tool_config_impl , validate_tools
21+ load_last_tool_config_impl , validate_tool_impl
2522)
23+ from consts .exceptions import MCPConnectionError , NotFoundException , ToolExecutionException
24+ from consts .model import ToolInfo , ToolSourceEnum , ToolInstanceInfoRequest , ToolValidateRequest
2625
2726
2827class TestPythonTypeToJsonSchema :
@@ -1422,7 +1421,7 @@ async def test_validate_tool_nexent(self, mock_validate_nexent):
14221421 inputs = {"param" : "value" }
14231422 )
14241423
1425- result = await validate_tools (request , "tenant1" )
1424+ result = await validate_tool_impl (request , "tenant1" )
14261425
14271426 assert result == "nexent result"
14281427 mock_validate_nexent .assert_called_once_with (
@@ -1440,7 +1439,7 @@ async def test_validate_tool_remote(self, mock_validate_remote):
14401439 inputs = {"param" : "value" }
14411440 )
14421441
1443- result = await validate_tools (request , "tenant1" )
1442+ result = await validate_tool_impl (request , "tenant1" )
14441443
14451444 assert result == "remote result"
14461445 mock_validate_remote .assert_called_once_with (
@@ -1459,7 +1458,7 @@ async def test_validate_tool_local(self, mock_validate_local):
14591458 params = {"config" : "value" }
14601459 )
14611460
1462- result = await validate_tools (request , "tenant1" )
1461+ result = await validate_tool_impl (request , "tenant1" )
14631462
14641463 assert result == "local result"
14651464 mock_validate_local .assert_called_once_with (
@@ -1477,7 +1476,7 @@ async def test_validate_tool_langchain(self, mock_validate_langchain):
14771476 inputs = {"param" : "value" }
14781477 )
14791478
1480- result = await validate_tools (request , "tenant1" )
1479+ result = await validate_tool_impl (request , "tenant1" )
14811480
14821481 assert result == "langchain result"
14831482 mock_validate_langchain .assert_called_once_with (
@@ -1493,7 +1492,7 @@ async def test_validate_tool_unsupported_source(self):
14931492 )
14941493
14951494 with pytest .raises (ToolExecutionException , match = "Validate Tool failed" ):
1496- await validate_tools (request , "tenant1" )
1495+ await validate_tool_impl (request , "tenant1" )
14971496
14981497 @patch ('backend.services.tool_configuration_service._validate_mcp_tool_nexent' )
14991498 async def test_validate_tool_nexent_connection_error (self , mock_validate_nexent ):
@@ -1508,10 +1507,8 @@ async def test_validate_tool_nexent_connection_error(self, mock_validate_nexent)
15081507 inputs = {"param" : "value" }
15091508 )
15101509
1511- from backend .services .tool_configuration_service import validate_tools
1512-
15131510 with pytest .raises (MCPConnectionError , match = "MCP connection failed: Connection failed" ):
1514- await validate_tools (request , "tenant1" )
1511+ await validate_tool_impl (request , "tenant1" )
15151512
15161513 @patch ('backend.services.tool_configuration_service._validate_local_tool' )
15171514 async def test_validate_tool_local_execution_error (self , mock_validate_local ):
@@ -1526,10 +1523,8 @@ async def test_validate_tool_local_execution_error(self, mock_validate_local):
15261523 params = {"config" : "value" }
15271524 )
15281525
1529- from backend .services .tool_configuration_service import validate_tools
1530-
15311526 with pytest .raises (ToolExecutionException , match = "Validate Tool failed" ):
1532- await validate_tools (request , "tenant1" )
1527+ await validate_tool_impl (request , "tenant1" )
15331528
15341529
15351530if __name__ == '__main__' :
0 commit comments