From 688b35efa824d5359e115d868f6fae0ea4adadb3 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Sun, 13 Sep 2026 02:05:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(test):=20=E7=BB=9F=E4=B8=80test=5Flipsync?= =?UTF-8?q?=5Ftts=E6=8C=81=E4=B9=85=E5=8C=96=E6=B5=8B=E8=AF=95upload=5Furl?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=B8=8Ekey=E4=B8=80=E8=87=B4=EF=BC=8C?= =?UTF-8?q?=E6=B6=88=E9=99=A4flaky?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/unit/test_lipsync_tts.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/unit/test_lipsync_tts.py b/tests/unit/test_lipsync_tts.py index cc57603b2..ecbb86812 100644 --- a/tests/unit/test_lipsync_tts.py +++ b/tests/unit/test_lipsync_tts.py @@ -448,7 +448,7 @@ class TestPersistOutputVideoTask: job = self._make_persist_job(output_video_url="https://temp.mk/x.mp4") session, fake_client, storage, patches = self._persist_patches( - job=job, video_bytes=b"VIDEODATA", upload_url="https://oss.example.com/lipsync-outputs/u1/j1.mp4" + job=job, video_bytes=b"VIDEODATA", upload_url="https://oss.example.com/lipsync-outputs/user-1/job-1.mp4" ) entered = [p.__enter__() for p in patches] try: @@ -459,17 +459,11 @@ class TestPersistOutputVideoTask: fake_client.get.assert_called_once_with("https://temp.mk/x.mp4") storage.upload_file.assert_called_once() - # 上传的 key 必须是 lipsync-outputs/{user_id}/{job_id}.mp4 - key_arg = ( - storage.upload_file.call_args.args[1] - if storage.upload_file.call_args.args - else storage.upload_file.call_args.kwargs.get("key") - ) - # upload_file(data, key, content_type=...) call_args = storage.upload_file.call_args.args + # 上传的 key 必须是 lipsync-outputs/{user_id}/{job_id}.mp4 assert call_args[1] == "lipsync-outputs/user-1/job-1.mp4" - # output_video_url 被替换为签名后的永久 URL - assert job.output_video_url == "https://oss.example.com/lipsync-outputs/u1/j1.mp4?signed" + # upload_file 返回永久 URL,再被 _sign_media_url 追加 ?signed + assert job.output_video_url == "https://oss.example.com/lipsync-outputs/user-1/job-1.mp4?signed" assert job.updated_at is not None session.commit.assert_called_once() session.close.assert_called_once()