From caa5113f7f811b6dcd961d7e20bd2454d84618bf Mon Sep 17 00:00:00 2001 From: CI Bot Date: Mon, 17 Aug 2026 20:08:48 +0800 Subject: [PATCH 1/2] fix(test): add missing str fields to mock clip to fix Pydantic validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _make_mock_clip used MagicMock which auto-creates attributes as MagicMock objects. EditorClipResponse requires template_clip_config_id, created_at, and updated_at to be str. Pydantic validation fails with MagicMock values. Fix: explicitly set these fields to proper types in _make_mock_clip: - template_clip_config_id = "" - created_at = None (handled by _fmt_dt → "") - updated_at = None (handled by _fmt_dt → "") Fixes 7 failing tests in TestClipEndpoints and TestClipSplitMerge. --- tests/unit/test_templates_editor_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/unit/test_templates_editor_api.py b/tests/unit/test_templates_editor_api.py index 361866831..4db7e4d7d 100755 --- a/tests/unit/test_templates_editor_api.py +++ b/tests/unit/test_templates_editor_api.py @@ -61,6 +61,9 @@ def _make_mock_clip(clip_id="clip-001", order=0, duration=10.0, clip_type="video clip.config = {} clip.asset_id = "asset-001" clip.status = "ready" + clip.template_clip_config_id = "" + clip.created_at = None + clip.updated_at = None return clip -- 2.54.0 From 8799eb8ff5b115b630d1baf9da42c89e8d629ef8 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Mon, 17 Aug 2026 20:15:33 +0800 Subject: [PATCH 2/2] fix(test): fix merge response assertion for TestClipSplitMerge The merge endpoint returns {"merged_clip": {...}, "deleted_clip_ids": [...]} not a flat clip object. Update test_merge_clips_success to check data["merged_clip"] instead of data directly. --- tests/unit/test_templates_editor_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_templates_editor_api.py b/tests/unit/test_templates_editor_api.py index 4db7e4d7d..06044e2a6 100755 --- a/tests/unit/test_templates_editor_api.py +++ b/tests/unit/test_templates_editor_api.py @@ -330,7 +330,8 @@ class TestClipSplitMerge: resp = c.post(BASE + "/clips/merge", json={"clip_ids": ["clip-001", "clip-002"]}) assert resp.status_code == 200 data = resp.json() - assert "id" in data + assert "merged_clip" in data + assert "id" in data["merged_clip"] mock_plan_svc.merge_clips.assert_called_once_with(["clip-001", "clip-002"]) def test_merge_clips_single_422(self, client): -- 2.54.0