fix: 5 agents — core 703/703, settings 38/38, git edges 191/191, API routes 1139/1140, plugins +70 coverage
This commit is contained in:
@@ -134,6 +134,11 @@ class TestCreateMapping:
|
||||
mock_db = MagicMock()
|
||||
mock_db.query.return_value.filter.return_value.first.return_value = None
|
||||
|
||||
# Simulate db.refresh setting the id
|
||||
def _refresh(obj):
|
||||
obj.id = "map-new-1"
|
||||
mock_db.refresh.side_effect = _refresh
|
||||
|
||||
from src.core.database import get_db
|
||||
client = _make_client({get_db: lambda: mock_db})
|
||||
resp = client.post("/api/mappings", json=self.CREATE_PAYLOAD)
|
||||
@@ -166,7 +171,7 @@ class TestSuggestMappingsApi:
|
||||
mock_suggestions = [{"source": "db1", "target": "db2", "score": 0.95}]
|
||||
|
||||
from src.dependencies import get_config_manager
|
||||
with patch("src.api.routes.mappings.MappingService") as MockMappingSvc:
|
||||
with patch("src.services.mapping_service.MappingService") as MockMappingSvc:
|
||||
instance = MagicMock()
|
||||
instance.get_suggestions = AsyncMock(return_value=mock_suggestions)
|
||||
MockMappingSvc.return_value = instance
|
||||
@@ -180,7 +185,7 @@ class TestSuggestMappingsApi:
|
||||
def test_error(self):
|
||||
mock_config = MagicMock()
|
||||
from src.dependencies import get_config_manager
|
||||
with patch("src.api.routes.mappings.MappingService") as MockMappingSvc:
|
||||
with patch("src.services.mapping_service.MappingService") as MockMappingSvc:
|
||||
instance = MagicMock()
|
||||
instance.get_suggestions = AsyncMock(side_effect=RuntimeError("suggestion failed"))
|
||||
MockMappingSvc.return_value = instance
|
||||
|
||||
Reference in New Issue
Block a user