feat(product-suite): add global generation history

This commit is contained in:
chengma
2026-07-17 09:59:55 +08:00
parent f1dc7f28dc
commit e232097ba5
13 changed files with 1409 additions and 52 deletions
+38
View File
@@ -22,6 +22,7 @@ from app.gui.workers import (
ImageStudioPullImagesWorker,
ProductSuiteAiWriteWorker,
ProductSuiteGenerateWorker,
ProductSuiteHistoryExportWorker,
)
@@ -229,6 +230,43 @@ class WorkerTests(unittest.TestCase):
gen_title.assert_not_called()
self.assertEqual(expected, result)
def test_product_suite_history_export_worker_uses_round_export_service(self):
worker = ProductSuiteHistoryExportWorker(
7,
"round-key",
"D:/exports",
db_path="suite.db",
)
expected = SimpleNamespace(
target_dir="D:/exports/main-shop_51100639510_20260717",
files=(object(), object()),
skipped_count=1,
cancelled=False,
)
with mock.patch(
"app.gui.workers.image_studio_export.export_generation_round",
return_value=expected,
) as export_round:
result = worker.execute()
export_round.assert_called_once_with(
7,
"round-key",
"D:/exports",
path="suite.db",
should_stop=worker.should_cancel,
)
self.assertEqual(
{
"target_dir": expected.target_dir,
"file_count": 2,
"skipped_count": 1,
"cancelled": False,
},
result,
)
def test_product_suite_worker_writes_generation_round_and_stable_slots(self):
with tempfile.TemporaryDirectory() as temp_dir:
db_path = os.path.join(temp_dir, "cmshopee.db")