test: 8 parallel agents — fix 150+ failures, add 30+ test files. schemas/models 99-100%, core/client_registry ~98%, maintenance 95-98%, git edges 97%, translate 98-100%, dashboard routes 95-96%, dataset_review 100%
This commit is contained in:
@@ -59,7 +59,7 @@ def _make_client(overrides: dict | None = None) -> TestClient:
|
||||
# ── get_dashboards ──
|
||||
|
||||
class TestGetDashboards:
|
||||
"""GET /environments/{env_id}/dashboards"""
|
||||
"""GET /api/environments/{env_id}/dashboards"""
|
||||
|
||||
def test_success(self):
|
||||
mock_config = MagicMock()
|
||||
@@ -72,7 +72,7 @@ class TestGetDashboards:
|
||||
from src.dependencies import get_config_manager
|
||||
with patch("src.api.routes.migration.AsyncSupersetClient", return_value=mock_client):
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.get("/environments/env-1/dashboards")
|
||||
resp = client.get("/api/environments/env-1/dashboards")
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert len(data) == 1
|
||||
@@ -84,7 +84,7 @@ class TestGetDashboards:
|
||||
|
||||
from src.dependencies import get_config_manager
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.get("/environments/bad-env/dashboards")
|
||||
resp = client.get("/api/environments/bad-env/dashboards")
|
||||
assert resp.status_code == 404
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ class TestExecuteMigration:
|
||||
get_config_manager: lambda: mock_config,
|
||||
get_task_manager: lambda: mock_tm,
|
||||
})
|
||||
resp = client.post("/migration/execute", json=self.SELECTION_PAYLOAD)
|
||||
resp = client.post("/api/migration/execute", json=self.SELECTION_PAYLOAD)
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert data["task_id"] == "task-123"
|
||||
@@ -126,7 +126,7 @@ class TestExecuteMigration:
|
||||
|
||||
from src.dependencies import get_config_manager
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.post("/migration/execute", json=self.SELECTION_PAYLOAD)
|
||||
resp = client.post("/api/migration/execute", json=self.SELECTION_PAYLOAD)
|
||||
assert resp.status_code == 400
|
||||
|
||||
def test_invalid_target_env(self):
|
||||
@@ -135,7 +135,16 @@ class TestExecuteMigration:
|
||||
|
||||
from src.dependencies import get_config_manager
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.post("/migration/execute", json=self.SELECTION_PAYLOAD)
|
||||
resp = client.post("/api/migration/execute", json=self.SELECTION_PAYLOAD)
|
||||
assert resp.status_code == 400
|
||||
|
||||
def test_invalid_target_env(self):
|
||||
mock_config = MagicMock()
|
||||
mock_config.get_environments.return_value = [_make_env("env-2")]
|
||||
|
||||
from src.dependencies import get_config_manager
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.post("/api/migration/execute", json=self.SELECTION_PAYLOAD)
|
||||
assert resp.status_code == 400
|
||||
|
||||
def test_task_creation_fails(self):
|
||||
@@ -152,7 +161,7 @@ class TestExecuteMigration:
|
||||
get_config_manager: lambda: mock_config,
|
||||
get_task_manager: lambda: mock_tm,
|
||||
})
|
||||
resp = client.post("/migration/execute", json=self.SELECTION_PAYLOAD)
|
||||
resp = client.post("/api/migration/execute", json=self.SELECTION_PAYLOAD)
|
||||
assert resp.status_code == 500
|
||||
|
||||
|
||||
@@ -181,7 +190,7 @@ class TestDryRunMigration:
|
||||
from src.dependencies import get_config_manager
|
||||
with patch("src.api.routes.migration.MigrationDryRunService", return_value=mock_dry_run):
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.post("/migration/dry-run", json=self.SELECTION_PAYLOAD)
|
||||
resp = client.post("/api/migration/dry-run", json=self.SELECTION_PAYLOAD)
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["summary"] == "ok"
|
||||
|
||||
@@ -192,7 +201,7 @@ class TestDryRunMigration:
|
||||
|
||||
from src.dependencies import get_config_manager
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.post("/migration/dry-run", json={
|
||||
resp = client.post("/api/migration/dry-run", json={
|
||||
"source_env_id": "env-1", "target_env_id": "env-1", "selected_ids": [1],
|
||||
})
|
||||
assert resp.status_code == 400
|
||||
@@ -203,7 +212,7 @@ class TestDryRunMigration:
|
||||
|
||||
from src.dependencies import get_config_manager
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.post("/migration/dry-run", json=self.SELECTION_PAYLOAD)
|
||||
resp = client.post("/api/migration/dry-run", json=self.SELECTION_PAYLOAD)
|
||||
assert resp.status_code == 400
|
||||
|
||||
def test_no_dashboards_selected(self):
|
||||
@@ -214,7 +223,7 @@ class TestDryRunMigration:
|
||||
|
||||
from src.dependencies import get_config_manager
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.post("/migration/dry-run", json={
|
||||
resp = client.post("/api/migration/dry-run", json={
|
||||
"source_env_id": "env-1", "target_env_id": "env-2", "selected_ids": [],
|
||||
})
|
||||
assert resp.status_code == 400
|
||||
@@ -231,7 +240,7 @@ class TestDryRunMigration:
|
||||
from src.dependencies import get_config_manager
|
||||
with patch("src.api.routes.migration.MigrationDryRunService", return_value=mock_dry_run):
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.post("/migration/dry-run", json=self.SELECTION_PAYLOAD)
|
||||
resp = client.post("/api/migration/dry-run", json=self.SELECTION_PAYLOAD)
|
||||
assert resp.status_code == 500
|
||||
|
||||
|
||||
@@ -248,7 +257,7 @@ class TestGetMigrationSettings:
|
||||
|
||||
from src.dependencies import get_config_manager
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.get("/migration/settings")
|
||||
resp = client.get("/api/migration/settings")
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["cron"] == "0 2 * * *"
|
||||
|
||||
@@ -265,7 +274,7 @@ class TestUpdateMigrationSettings:
|
||||
|
||||
from src.dependencies import get_config_manager
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.put("/migration/settings", json={"cron": "0 3 * * *"})
|
||||
resp = client.put("/api/migration/settings", json={"cron": "0 3 * * *"})
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert data["cron"] == "0 3 * * *"
|
||||
@@ -276,7 +285,7 @@ class TestUpdateMigrationSettings:
|
||||
mock_config = MagicMock()
|
||||
from src.dependencies import get_config_manager
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.put("/migration/settings", json={})
|
||||
resp = client.put("/api/migration/settings", json={})
|
||||
assert resp.status_code == 400
|
||||
|
||||
|
||||
@@ -300,7 +309,7 @@ class TestGetResourceMappings:
|
||||
|
||||
from src.core.database import get_db
|
||||
client = _make_client({get_db: lambda: mock_db})
|
||||
resp = client.get("/migration/mappings-data")
|
||||
resp = client.get("/api/migration/mappings-data")
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert data["total"] == 2
|
||||
@@ -316,7 +325,7 @@ class TestGetResourceMappings:
|
||||
|
||||
from src.core.database import get_db
|
||||
client = _make_client({get_db: lambda: mock_db})
|
||||
resp = client.get("/migration/mappings-data?env_id=env-1&resource_type=database&search=test&skip=0&limit=10")
|
||||
resp = client.get("/api/migration/mappings-data?env_id=env-1&resource_type=database&search=test&skip=0&limit=10")
|
||||
assert resp.status_code == 200
|
||||
|
||||
|
||||
@@ -345,7 +354,7 @@ class TestTriggerSyncNow:
|
||||
get_config_manager: lambda: mock_config,
|
||||
get_db: lambda: mock_db,
|
||||
})
|
||||
resp = client.post("/migration/sync-now")
|
||||
resp = client.post("/api/migration/sync-now")
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert data["status"] == "completed"
|
||||
@@ -383,7 +392,7 @@ class TestTriggerSyncNow:
|
||||
get_config_manager: lambda: mock_config,
|
||||
get_db: lambda: mock_db,
|
||||
})
|
||||
resp = client.post("/migration/sync-now")
|
||||
resp = client.post("/api/migration/sync-now")
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert data["synced_count"] == 1
|
||||
|
||||
Reference in New Issue
Block a user