fix: stabilize Shopee cover replacement

This commit is contained in:
chengma
2026-07-01 08:35:46 +08:00
parent f7ea9ec0fa
commit 483bec427c
18 changed files with 782 additions and 330 deletions
+12 -1
View File
@@ -277,7 +277,18 @@ class AITests(TempDirMixin, unittest.TestCase):
updated = db.list_tasks(batch_id=batch_id, path=cfg["db_path"])
self.assertTrue(all(task.stage == "generated" for task in updated))
self.assertEqual({"新旧标题A", "新旧标题B"}, {task.new_title for task in updated})
self.assertTrue(all(task.new_cover_path.endswith("_new.jpg") for task in updated))
expected_cover_paths = {
os.path.abspath(
os.path.join(
cfg["image_dir"],
str(task.batch_id),
"main",
f"{task.id}_{task.item_id}_new.jpg",
)
)
for task in updated
}
self.assertEqual(expected_cover_paths, {task.new_cover_path for task in updated})
self.assertTrue(all(os.path.exists(task.new_cover_path) for task in updated))
self.assertIn("主店", "\n".join(cover_prompts))
self.assertIn("新旧标题A", "\n".join(cover_prompts))