From 648eb9638a17a588c93665e880ffebc59a7f5c07 Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Fri, 13 Feb 2026 14:40:55 +0100 Subject: [PATCH] fix bodged merge --- .../backend/copilot/tools/find_block_test.py | 12 +++++++---- .../backend/copilot/tools/run_block_test.py | 20 +++++++++++-------- .../copilot/tools/test_run_block_details.py | 4 ++-- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/autogpt_platform/backend/backend/copilot/tools/find_block_test.py b/autogpt_platform/backend/backend/copilot/tools/find_block_test.py index 3c62fc8522..414bbdc6f0 100644 --- a/autogpt_platform/backend/backend/copilot/tools/find_block_test.py +++ b/autogpt_platform/backend/backend/copilot/tools/find_block_test.py @@ -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() diff --git a/autogpt_platform/backend/backend/copilot/tools/run_block_test.py b/autogpt_platform/backend/backend/copilot/tools/run_block_test.py index 89a30406be..b13a339127 100644 --- a/autogpt_platform/backend/backend/copilot/tools/run_block_test.py +++ b/autogpt_platform/backend/backend/copilot/tools/run_block_test.py @@ -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() diff --git a/autogpt_platform/backend/backend/copilot/tools/test_run_block_details.py b/autogpt_platform/backend/backend/copilot/tools/test_run_block_details.py index 82b50a61f0..c5d3986df2 100644 --- a/autogpt_platform/backend/backend/copilot/tools/test_run_block_details.py +++ b/autogpt_platform/backend/backend/copilot/tools/test_run_block_details.py @@ -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(