feat: Enhance ID mapping service robustness, add defensive guards, and expand migration engine and API testing.

This commit is contained in:
2026-02-25 14:44:21 +03:00
parent 33433c3173
commit 2a5b225800
11 changed files with 640 additions and 32 deletions

View File

@@ -0,0 +1,24 @@
import pytest
from unittest.mock import MagicMock
from src.services.git_service import GitService
from src.core.superset_client import SupersetClient
from src.core.config_models import Environment
def test_git_service_get_repo_path_guard():
"""Verify that _get_repo_path raises ValueError if dashboard_id is None."""
service = GitService(base_path="test_repos")
with pytest.raises(ValueError, match="dashboard_id cannot be None"):
service._get_repo_path(None)
def test_superset_client_import_dashboard_guard():
"""Verify that import_dashboard raises ValueError if file_name is None."""
mock_env = Environment(
id="test",
name="test",
url="http://localhost:8088",
username="admin",
password="admin"
)
client = SupersetClient(mock_env)
with pytest.raises(ValueError, match="file_name cannot be None"):
client.import_dashboard(None)