fix: capture invalid product toast and close failed tabs
This commit is contained in:
@@ -3,6 +3,7 @@ import unittest
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
from types import SimpleNamespace
|
||||
from unittest import mock
|
||||
|
||||
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
|
||||
@@ -82,6 +83,34 @@ class GuiTests(TempDirMixin, unittest.TestCase):
|
||||
self.assertIsNotNone(value)
|
||||
self.assertEqual(color, value.name())
|
||||
|
||||
def test_collect_table_shows_product_unavailable_only_for_explicit_error(self):
|
||||
account = SimpleNamespace(alias="papa", account_name="papa 店铺")
|
||||
invalid_task = SimpleNamespace(
|
||||
alias="papa",
|
||||
account_name="papa 店铺",
|
||||
item_id="25120403046",
|
||||
stage="imported",
|
||||
status="failed",
|
||||
last_error="商品失效:please input correct product id",
|
||||
)
|
||||
generic_task = SimpleNamespace(
|
||||
alias="papa",
|
||||
account_name="papa 店铺",
|
||||
item_id="26887160467",
|
||||
stage="imported",
|
||||
status="failed",
|
||||
last_error="等待 Shopee 商品编辑器就绪超时",
|
||||
)
|
||||
model = gui.TaskTableModel()
|
||||
model.set_tasks([invalid_task, generic_task], [account])
|
||||
|
||||
self.assertEqual("商品失效", model.data(model.index(0, 3), gui.Qt.DisplayRole))
|
||||
self.assertEqual("失败", model.data(model.index(1, 3), gui.Qt.DisplayRole))
|
||||
self.assertIn(
|
||||
"please input correct product id",
|
||||
model.data(model.index(0, 3), gui.Qt.ToolTipRole),
|
||||
)
|
||||
|
||||
def test_main_window_has_five_tabs_in_workflow_order(self):
|
||||
with self.make_temp_dir() as temp_dir:
|
||||
window = MainWindow(config=self.make_config(temp_dir))
|
||||
|
||||
Reference in New Issue
Block a user