From f6bfaa5aaf5c86e2a4d94e7f94dbe6911114090b Mon Sep 17 00:00:00 2001 From: CI Bot Date: Tue, 14 Jul 2026 00:45:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(test):=20=E4=BF=AE=E5=A4=8Dedit=5Fplan=5Fge?= =?UTF-8?q?neration=20celery=20mock=E8=B7=AF=E5=BE=84=20+=20asset=5Flibrar?= =?UTF-8?q?y=E5=88=A0=E9=99=A4=E6=96=AD=E8=A8=80=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/unit/test_asset_library_delete.py | 2 +- tests/unit/test_edit_plan_generation_api.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) mode change 100755 => 100644 tests/unit/test_edit_plan_generation_api.py diff --git a/tests/unit/test_asset_library_delete.py b/tests/unit/test_asset_library_delete.py index 9c4178be6..3b595b079 100644 --- a/tests/unit/test_asset_library_delete.py +++ b/tests/unit/test_asset_library_delete.py @@ -219,7 +219,7 @@ class TestDeleteAssetLibrary: response = client.delete("/api/v1/asset-libraries/lib-1") assert response.status_code == 403 - assert "Access denied" in response.json()["detail"] + assert "无权访问该项目" in response.json()["detail"] # 库未被删除 assert lib_repo.find_by_id("lib-1") is not None diff --git a/tests/unit/test_edit_plan_generation_api.py b/tests/unit/test_edit_plan_generation_api.py old mode 100755 new mode 100644 index 8f05cd720..1479514d9 --- a/tests/unit/test_edit_plan_generation_api.py +++ b/tests/unit/test_edit_plan_generation_api.py @@ -318,7 +318,7 @@ class TestGeneratePlan: clip = _make_clip(plan.id, order=1) clip_repo.create(clip) - with patch("app.api.routes.edit_plans.celery_app") as mock_celery: + with patch("app.api.routes.edit_plans_generation.celery_app") as mock_celery: mock_celery.send_task = MagicMock() resp = client.post(f"/api/v1/edit-plans/{plan.id}/generate") @@ -406,7 +406,7 @@ class TestGeneratePlan: clip = _make_clip(plan.id, order=1, status=EditPlanClipStatus.READY) clip_repo.create(clip) - with patch("app.api.routes.edit_plans.celery_app") as mock_celery: + with patch("app.api.routes.edit_plans_generation.celery_app") as mock_celery: mock_celery.send_task = MagicMock() resp = client.post(f"/api/v1/edit-plans/{plan.id}/generate") @@ -427,7 +427,7 @@ class TestGeneratePlan: clip = _make_clip(plan.id, order=i + 1) clip_repo.create(clip) - with patch("app.api.routes.edit_plans.celery_app") as mock_celery: + with patch("app.api.routes.edit_plans_generation.celery_app") as mock_celery: mock_celery.send_task = MagicMock() resp = client.post(f"/api/v1/edit-plans/{plan.id}/generate") @@ -580,7 +580,7 @@ class TestResponseSchema: clip = _make_clip(plan.id, order=1) clip_repo.create(clip) - with patch("app.api.routes.edit_plans.celery_app") as mock_celery: + with patch("app.api.routes.edit_plans_generation.celery_app") as mock_celery: mock_celery.send_task = MagicMock() resp = client.post(f"/api/v1/edit-plans/{plan.id}/generate") @@ -623,7 +623,7 @@ class TestGeneratePlanErrorHandling: clip = _make_clip(plan.id, order=1) clip_repo.create(clip) - with patch("app.api.routes.edit_plans.celery_app") as mock_celery: + with patch("app.api.routes.edit_plans_generation.celery_app") as mock_celery: # 模拟 Celery 调度失败 mock_celery.send_task.side_effect = RuntimeError("Redis 连接超时") resp = client.post(f"/api/v1/edit-plans/{plan.id}/generate") @@ -647,7 +647,7 @@ class TestGeneratePlanErrorHandling: clip = _make_clip(plan.id, order=1) clip_repo.create(clip) - with patch("app.api.routes.edit_plans.celery_app") as mock_celery: + with patch("app.api.routes.edit_plans_generation.celery_app") as mock_celery: mock_celery.send_task.side_effect = RuntimeError("调度失败") resp = client.post(f"/api/v1/edit-plans/{plan.id}/generate") @@ -668,7 +668,7 @@ class TestGeneratePlanErrorHandling: clip = _make_clip(plan.id, order=1) clip_repo.create(clip) - with patch("app.api.routes.edit_plans.celery_app") as mock_celery: + with patch("app.api.routes.edit_plans_generation.celery_app") as mock_celery: mock_celery.send_task.side_effect = ConnectionError("Broker 不可达") resp = client.post(f"/api/v1/edit-plans/{plan.id}/generate")