feat(status): default legacy batches to normal

This commit is contained in:
chengma
2026-07-20 09:41:55 +08:00
parent 00c695d035
commit d687c833e0
17 changed files with 205 additions and 991 deletions
-42
View File
@@ -941,48 +941,6 @@ class EditorLoginTests(unittest.TestCase):
self.assertIsNone(result["product_status_note"])
self.assertIn("状态读取失败", result["product_status_error"])
def test_recheck_product_status_reads_only_status_and_closes_new_tab(self):
cdp = FakeProductCDP("ws-status-recheck", alerts=[])
steps = []
with mock.patch("app.editor.open_product", return_value=cdp), mock.patch(
"app.editor.read_title"
) as read_title, mock.patch("app.editor.read_cover_src") as read_cover_src, mock.patch(
"app.editor.download_cover"
) as download_cover:
result = editor.recheck_product_status(
{"debug_port": 9222},
{"item_id": "51100639510"},
on_step=steps.append,
)
self.assertEqual("normal", result["product_status"])
self.assertIsNone(result["close_target_confirmed"])
self.assertEqual(["read_product_status"], steps)
self.assertTrue(cdp.closed)
read_title.assert_not_called()
read_cover_src.assert_not_called()
download_cover.assert_not_called()
def test_recheck_product_status_does_not_return_unknown_snapshot_on_read_error(self):
cdp = FakeProductCDP("ws-status-recheck", alerts=[])
with mock.patch("app.editor.open_product", return_value=cdp), mock.patch(
"app.editor.read_product_status",
return_value={
"product_status": "unknown",
"product_status_note": None,
"product_status_error": "CDP 页面读取失败",
},
):
with self.assertRaises(editor.EditorError):
editor.recheck_product_status(
{"debug_port": 9222},
{"item_id": "51100639510"},
)
self.assertTrue(cdp.closed)
def test_collect_reads_product_status_before_title_and_returns_snapshot(self):
cdp = FakeProductCDP("ws-new", alerts=[])
steps = []