fix bodged merge

This commit is contained in:
Reinier van der Leer
2026-02-13 14:40:55 +01:00
parent 74477bbbf3
commit 648eb9638a
3 changed files with 22 additions and 14 deletions

View File

@@ -361,12 +361,16 @@ class TestFindBlockFiltering:
for d in block_defs
}
mock_search_db = MagicMock()
mock_search_db.unified_hybrid_search = AsyncMock(
return_value=(search_results, len(search_results))
)
with patch(
"backend.api.features.chat.tools.find_block.unified_hybrid_search",
new_callable=AsyncMock,
return_value=(search_results, len(search_results)),
"backend.copilot.tools.find_block.search",
return_value=mock_search_db,
), patch(
"backend.api.features.chat.tools.find_block.get_block",
"backend.copilot.tools.find_block.get_block",
side_effect=lambda bid: mock_blocks.get(bid),
):
tool = FindBlockTool()

View File

@@ -183,7 +183,7 @@ class TestRunBlockInputValidation:
)
with patch(
"backend.api.features.chat.tools.run_block.get_block",
"backend.copilot.tools.run_block.get_block",
return_value=mock_block,
):
tool = RunBlockTool()
@@ -222,7 +222,7 @@ class TestRunBlockInputValidation:
)
with patch(
"backend.api.features.chat.tools.run_block.get_block",
"backend.copilot.tools.run_block.get_block",
return_value=mock_block,
):
tool = RunBlockTool()
@@ -263,7 +263,7 @@ class TestRunBlockInputValidation:
)
with patch(
"backend.api.features.chat.tools.run_block.get_block",
"backend.copilot.tools.run_block.get_block",
return_value=mock_block,
):
tool = RunBlockTool()
@@ -302,15 +302,19 @@ class TestRunBlockInputValidation:
mock_block.execute = mock_execute
mock_workspace_db = MagicMock()
mock_workspace_db.get_or_create_workspace = AsyncMock(
return_value=MagicMock(id="test-workspace-id")
)
with (
patch(
"backend.api.features.chat.tools.run_block.get_block",
"backend.copilot.tools.run_block.get_block",
return_value=mock_block,
),
patch(
"backend.api.features.chat.tools.run_block.get_or_create_workspace",
new_callable=AsyncMock,
return_value=MagicMock(id="test-workspace-id"),
"backend.copilot.tools.run_block.workspace_db",
return_value=mock_workspace_db,
),
):
tool = RunBlockTool()
@@ -344,7 +348,7 @@ class TestRunBlockInputValidation:
)
with patch(
"backend.api.features.chat.tools.run_block.get_block",
"backend.copilot.tools.run_block.get_block",
return_value=mock_block,
):
tool = RunBlockTool()

View File

@@ -61,7 +61,7 @@ async def test_run_block_returns_details_when_no_input_provided():
)
with patch(
"backend.api.features.chat.tools.run_block.get_block",
"backend.copilot.tools.run_block.get_block",
return_value=http_block,
):
# Mock credentials check to return no missing credentials
@@ -120,7 +120,7 @@ async def test_run_block_returns_details_when_only_credentials_provided():
}
with patch(
"backend.api.features.chat.tools.run_block.get_block",
"backend.copilot.tools.run_block.get_block",
return_value=mock,
):
with patch.object(