feat(git): clarify dashboard release flow
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
# @TEST_CONTRACT: MergeConflictFileSchema -> file_path required, mine/theirs optional
|
||||
# @TEST_CONTRACT: MergeResolveRequest -> wraps ConflictResolution list
|
||||
# @TEST_CONTRACT: MergeContinueRequest -> optional message
|
||||
# @TEST_CONTRACT: DeployRequest -> environment_id required
|
||||
# @TEST_CONTRACT: DeployRequest -> stage required
|
||||
# @TEST_CONTRACT: RepoInitRequest -> config_id + remote_url required
|
||||
# @TEST_CONTRACT: RepositoryBindingSchema -> all fields required
|
||||
# @TEST_CONTRACT: RepoStatusBatchRequest -> optional dashboard_ids list
|
||||
@@ -423,10 +423,11 @@ class TestDeployRequest:
|
||||
def test_valid(self):
|
||||
from src.api.routes.git_schemas import DeployRequest
|
||||
|
||||
obj = DeployRequest(environment_id="env-prod")
|
||||
assert obj.environment_id == "env-prod"
|
||||
obj = DeployRequest(stage="prod", source_branch="feature/revenue-kpi")
|
||||
assert obj.stage == "prod"
|
||||
assert obj.source_branch == "feature/revenue-kpi"
|
||||
|
||||
def test_missing_environment_id(self):
|
||||
def test_missing_stage(self):
|
||||
from src.api.routes.git_schemas import DeployRequest
|
||||
|
||||
with pytest.raises(ValidationError):
|
||||
@@ -674,8 +675,7 @@ class TestEnvironmentDeploymentStatus:
|
||||
def test_minimal(self):
|
||||
from src.api.routes.git_schemas import EnvironmentDeploymentStatus
|
||||
|
||||
obj = EnvironmentDeploymentStatus(environment_id="env-dev", stage="dev")
|
||||
assert obj.environment_id == "env-dev"
|
||||
obj = EnvironmentDeploymentStatus(stage="dev")
|
||||
assert obj.stage == "dev"
|
||||
assert obj.content_hash is None
|
||||
assert obj.deployed_at is None
|
||||
@@ -686,7 +686,6 @@ class TestEnvironmentDeploymentStatus:
|
||||
from src.api.routes.git_schemas import EnvironmentDeploymentStatus
|
||||
|
||||
obj = EnvironmentDeploymentStatus(
|
||||
environment_id="env-prod",
|
||||
stage="prod",
|
||||
content_hash="abc123",
|
||||
deployed_at="2026-01-01T00:00:00",
|
||||
@@ -701,7 +700,7 @@ class TestEnvironmentDeploymentStatus:
|
||||
def test_behind(self):
|
||||
from src.api.routes.git_schemas import EnvironmentDeploymentStatus
|
||||
|
||||
obj = EnvironmentDeploymentStatus(environment_id="env-preprod", stage="preprod", status="deployed", is_behind=True)
|
||||
obj = EnvironmentDeploymentStatus(stage="preprod", status="deployed", is_behind=True)
|
||||
assert obj.is_behind is True
|
||||
|
||||
|
||||
@@ -716,8 +715,8 @@ class TestDeploymentStatusResponse:
|
||||
|
||||
obj = DeploymentStatusResponse(
|
||||
environments=[
|
||||
EnvironmentDeploymentStatus(environment_id="env-dev", stage="dev", content_hash="abc", status="deployed"),
|
||||
EnvironmentDeploymentStatus(environment_id="env-prod", stage="prod"),
|
||||
EnvironmentDeploymentStatus(stage="dev", content_hash="abc", status="deployed"),
|
||||
EnvironmentDeploymentStatus(stage="prod"),
|
||||
],
|
||||
current_content_hash="abc",
|
||||
)
|
||||
|
||||
@@ -27,7 +27,10 @@ def _make_env(id_val="env-1", name="Test Env", url="https://example.com"):
|
||||
env.id = id_val
|
||||
env.name = name
|
||||
env.url = url
|
||||
env.username = "admin"
|
||||
env.password = "real-password"
|
||||
env.verify_ssl = True
|
||||
env.timeout = 30
|
||||
return env
|
||||
|
||||
|
||||
@@ -300,6 +303,23 @@ class TestAddEnvironment:
|
||||
resp = client.post("/api/settings/environments", json=self.ENV_PAYLOAD)
|
||||
assert resp.status_code == 400
|
||||
|
||||
def test_stage_only_update_skips_connection_validation(self):
|
||||
mock_config = MagicMock()
|
||||
old_env = _make_env()
|
||||
old_env.stage = "PROD"
|
||||
mock_config.get_environments.return_value = [old_env]
|
||||
mock_config.update_environment.return_value = True
|
||||
|
||||
with patch("src.api.routes.settings.AsyncSupersetClient") as mock_client_cls:
|
||||
from src.dependencies import get_config_manager
|
||||
client = _make_client({get_config_manager: lambda: mock_config})
|
||||
resp = client.put("/api/settings/environments/env-1", json={
|
||||
"id": "env-1", "name": "Test Env", "url": "https://example.com",
|
||||
"username": "admin", "password": "real-password", "stage": "DEV",
|
||||
})
|
||||
assert resp.status_code == 200
|
||||
mock_client_cls.assert_not_called()
|
||||
|
||||
|
||||
# ── update_environment ──
|
||||
|
||||
|
||||
Reference in New Issue
Block a user