mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
test(mcp): set server_id on openapi local fake tools (#44998)
Co-authored-by: yuneng <yuneng@berri.ai>
This commit is contained in:
parent
5ffad371b0
commit
5555e7f593
1 changed files with 5 additions and 0 deletions
|
|
@ -48,6 +48,7 @@ async def test_openapi_local_tool_runs_pre_call_tool_check():
|
|||
fake_tool.name = "list_pets"
|
||||
fake_tool.description = "test tool"
|
||||
fake_tool.input_schema = {"type": "object"}
|
||||
fake_tool.server_id = fake_server.server_id
|
||||
|
||||
pre_call = AsyncMock(return_value={})
|
||||
handle_local = AsyncMock(return_value=CallToolResult(content=[], is_error=False))
|
||||
|
|
@ -134,6 +135,7 @@ async def test_openapi_local_tool_blocked_when_pre_call_check_raises():
|
|||
fake_tool.name = "delete_pet"
|
||||
fake_tool.description = "test tool"
|
||||
fake_tool.input_schema = {"type": "object"}
|
||||
fake_tool.server_id = fake_server.server_id
|
||||
|
||||
pre_call = AsyncMock(
|
||||
side_effect=HTTPException(status_code=403, detail="not allowed")
|
||||
|
|
@ -284,6 +286,7 @@ async def test_openapi_local_tool_injects_resolved_oauth_token():
|
|||
fake_tool.name = "get_values"
|
||||
fake_tool.description = "test tool"
|
||||
fake_tool.input_schema = {"type": "object"}
|
||||
fake_tool.server_id = oauth_server.server_id
|
||||
captured: dict = {}
|
||||
|
||||
async def handle_local(_name, _arguments, _wire_compat):
|
||||
|
|
@ -632,6 +635,7 @@ async def test_per_server_auth_header_reaches_both_openapi_dispatch_arms(dispatc
|
|||
fake_tool.name = "list_reports"
|
||||
fake_tool.description = "test tool"
|
||||
fake_tool.input_schema = {"type": "object"}
|
||||
fake_tool.server_id = server.server_id
|
||||
with (
|
||||
patch.object(manager, "_get_mcp_server_from_tool_name", return_value=server),
|
||||
patch.object(mcp_operations.global_mcp_tool_registry, "get_tool", return_value=fake_tool),
|
||||
|
|
@ -705,6 +709,7 @@ async def test_local_dispatch_reports_the_outcome_instead_of_success(failure: st
|
|||
fake_tool.name = "list_reports"
|
||||
fake_tool.description = "test tool"
|
||||
fake_tool.input_schema = {"type": "object"}
|
||||
fake_tool.server_id = None
|
||||
fake_tool.handler = raising_handler
|
||||
server = MCPServer(
|
||||
server_id="srv-openapi",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue