feat(generate): confirm product status scope
This commit is contained in:
@@ -78,3 +78,57 @@ class ProductStatusTests(unittest.TestCase):
|
||||
self.assertEqual(product_status.STATUS_REVIEWING, result["product_status"])
|
||||
self.assertLessEqual(len(result["product_status_note"]), 2000)
|
||||
self.assertTrue(result["product_status_note"].startswith("标题:审核中;说明:"))
|
||||
|
||||
def test_generation_plan_filters_unknown_by_default_and_freezes_snapshot(self):
|
||||
normal = SimpleNamespace(
|
||||
id=1,
|
||||
updated_at="2026-07-18T10:00:00",
|
||||
product_status="normal",
|
||||
new_title=None,
|
||||
new_cover_path=None,
|
||||
)
|
||||
unlisted = {
|
||||
"id": 2,
|
||||
"updated_at": "2026-07-18T10:00:01",
|
||||
"product_status": "unlisted",
|
||||
"new_title": "已有标题",
|
||||
"new_cover_path": None,
|
||||
}
|
||||
unknown = SimpleNamespace(
|
||||
id=3,
|
||||
updated_at="2026-07-18T10:00:02",
|
||||
product_status=None,
|
||||
new_title=None,
|
||||
new_cover_path=None,
|
||||
)
|
||||
|
||||
normal_only = product_status.build_generation_plan(
|
||||
[normal, unlisted, unknown, normal],
|
||||
"title_cover",
|
||||
)
|
||||
all_statuses = product_status.build_generation_plan(
|
||||
[normal, unlisted, unknown],
|
||||
"title_cover",
|
||||
product_status.SCOPE_ALL,
|
||||
)
|
||||
changed = product_status.build_generation_plan(
|
||||
[
|
||||
normal,
|
||||
{
|
||||
**unlisted,
|
||||
"updated_at": "2026-07-18T10:01:00",
|
||||
},
|
||||
unknown,
|
||||
],
|
||||
"title_cover",
|
||||
)
|
||||
|
||||
self.assertEqual([1, 2, 3], [task.id if hasattr(task, "id") else task["id"] for task in normal_only["base_candidates"]])
|
||||
self.assertEqual([1], [task.id for task in normal_only["execution_tasks"]])
|
||||
self.assertEqual(2, normal_only["scope_excluded"])
|
||||
self.assertEqual(
|
||||
{"normal": 1, "unlisted": 1, "reviewing": 0, "unknown": 1},
|
||||
normal_only["status_counts"],
|
||||
)
|
||||
self.assertEqual([1, 2, 3], [task.id if hasattr(task, "id") else task["id"] for task in all_statuses["execution_tasks"]])
|
||||
self.assertNotEqual(normal_only["fingerprint"], changed["fingerprint"])
|
||||
|
||||
Reference in New Issue
Block a user