fix: 同步 edit_plans/edit_templates 测试断言到 Phase 8 config 标准化结构
Deploy / Staging E2E Tests (push) Has been cancelled
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
Deploy / Deploy Staging (push) Failing after 110h35m20s
CI/CD Pipeline / Frontend Lint (push) Failing after 110h35m29s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 110h35m29s
Deploy / Staging E2E Tests (push) Has been cancelled
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
Deploy / Deploy Staging (push) Failing after 110h35m20s
CI/CD Pipeline / Frontend Lint (push) Failing after 110h35m29s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 110h35m29s
Phase 8 引入 normalize_plan_config/normalize_template_config 后, API 会将 config 扩展为完整的结构化默认值(cover/title/subtitle/bgm), 但测试断言仍使用旧的简单 dict 格式,导致 4 个用例失败。 修复方式:导入 normalize_* 函数,断言改为期望标准化后的 config。 修复用例: - test_create_success (plans) - test_create_minimal (plans) - test_update_config (plans) - test_create_with_all_fields (templates)
This commit is contained in:
@@ -28,6 +28,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "apps" / "api"))
|
||||
from fastapi import FastAPI
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from packages.domain.config_schemas import normalize_plan_config
|
||||
from packages.domain.edit_plan import EditPlan, EditPlanStatus
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -190,7 +191,7 @@ class TestCreatePlan:
|
||||
assert data["template_id"] == "tpl-001"
|
||||
assert data["status"] == "draft"
|
||||
assert data["total_duration"] == 60.0
|
||||
assert data["config"] == {"bgm": "happy"}
|
||||
assert data["config"] == normalize_plan_config({"bgm": "happy"})
|
||||
assert "id" in data
|
||||
assert "created_at" in data
|
||||
|
||||
@@ -202,7 +203,7 @@ class TestCreatePlan:
|
||||
)
|
||||
assert resp.status_code == 201
|
||||
data = resp.json()
|
||||
assert data["config"] == {}
|
||||
assert data["config"] == normalize_plan_config(None)
|
||||
assert data["total_duration"] == 0.0
|
||||
|
||||
def test_create_empty_name_returns_422(self, client):
|
||||
@@ -386,7 +387,7 @@ class TestUpdatePlan:
|
||||
json={"config": {"bgm": "sad", "transition": "fade"}},
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["config"] == {"bgm": "sad", "transition": "fade"}
|
||||
assert resp.json()["config"] == normalize_plan_config({"bgm": "sad", "transition": "fade"})
|
||||
|
||||
def test_update_total_duration(self, client):
|
||||
c, repo = client
|
||||
|
||||
@@ -28,6 +28,7 @@ from fastapi.testclient import TestClient
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "apps", "api"))
|
||||
|
||||
from packages.domain.config_schemas import normalize_template_config
|
||||
from packages.domain.edit_template import EditTemplate, EditTemplateStatus
|
||||
|
||||
# ── Stub Repository ───────────────────────────────────────────────────────────
|
||||
@@ -276,7 +277,7 @@ class TestCreateTemplate:
|
||||
assert data["name"] == "完整模板"
|
||||
assert data["description"] == "完整描述"
|
||||
assert data["template_type"] == "vlog"
|
||||
assert data["config"] == {"key": "value"}
|
||||
assert data["config"] == normalize_template_config({"key": "value"})
|
||||
assert data["preview_url"] == "https://example.com/preview.mp4"
|
||||
assert data["sort_weight"] == 10
|
||||
|
||||
|
||||
Reference in New Issue
Block a user