fix: 统一视频自由创作标题

This commit is contained in:
hh
2026-07-13 21:53:15 +08:00
parent 3078271f97
commit 6131bcdd9d
7 changed files with 66 additions and 10 deletions
+18
View File
@@ -254,6 +254,24 @@ class FreeVideoAssetDeletionTests(TestCase):
self.assertEqual(trash_data["video_url"], "http://tos.example/video.mp4")
self.assertEqual(trash_data["thumbnail_url"], "http://tos.example/free-video-poster.jpg")
def test_asset_library_uses_full_free_video_title_and_searches_it(self):
"""资产库应从关联任务恢复历史截断标题,并支持搜索完整标题的后半段。"""
full_prompt = "@O1CN01anEq9u245Jn8Ccedn_!!4611686018427385691-0-s-完整后缀"
self.task.request_payload["prompt"] = full_prompt
self.task.save(update_fields=["request_payload"])
self.asset.name = full_prompt[:50] # 模拟旧版本写库的截断数据
self.asset.save(update_fields=["name"])
client = APIClient()
client.force_authenticate(self.user)
listing = client.get("/api/assets/?tab=video_creations&page_size=10").json()
self.assertEqual(listing["count"], 1)
self.assertEqual(listing["results"][0]["display_name"], full_prompt)
search = client.get(f"/api/assets/?tab=video_creations&q={full_prompt[-4:]}&page_size=10").json()
self.assertEqual([row["id"] for row in search["results"]], [str(self.asset.id)])
def test_direct_asset_delete_stays_in_asset_trash(self):
client = APIClient()
client.force_authenticate(self.user)