Skip to content

Commit 8c8aaf2

Browse files
committed
🧪 modify test_tool_config_app.py
1 parent a092793 commit 8c8aaf2

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

‎test/backend/app/test_tool_config_app.py‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
from unittest.mock import patch
1+
from unittest.mock import patch, MagicMock
22
import sys
33
import os
44

55
# Add path for correct imports
66
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../../backend"))
77

8-
# Mock dependencies before importing the actual app
9-
with patch('utils.auth_utils.get_current_user_id') as mock_get_user_id, \
10-
patch('services.tool_configuration_service.list_all_tools') as mock_list_all_tools, \
11-
patch('services.tool_configuration_service.search_tool_info_impl') as mock_search_tool_info, \
12-
patch('services.tool_configuration_service.update_tool_info_impl') as mock_update_tool_info, \
13-
patch('services.tool_configuration_service.update_tool_list') as mock_update_tool_list:
14-
8+
# Mock boto3 to avoid dependency issues
9+
sys.modules['boto3'] = MagicMock()
10+
11+
# Import exception classes
12+
from consts.exceptions import MCPConnectionError
13+
14+
# Mock dependencies before importing the actual app - using the same pattern as test_remote_mcp_app.py
15+
with patch('database.client.MinioClient', MagicMock()):
1516
import pytest
1617
from fastapi.testclient import TestClient
1718
from http import HTTPStatus
1819

19-
# Import exception classes
20-
from consts.exceptions import MCPConnectionError
21-
2220
# Create a test client with a fresh FastAPI app
2321
from apps.tool_config_app import router
2422
from fastapi import FastAPI
2523

2624
# Patch exception classes to ensure tests use correct exceptions
2725
import apps.tool_config_app as tool_config_app
2826
tool_config_app.MCPConnectionError = MCPConnectionError
29-
27+
3028
app = FastAPI()
3129
app.include_router(router)
3230
client = TestClient(app)

0 commit comments

Comments
 (0)