fix: 安全兼容采购规格繁简匹配 (#251)
This commit is contained in:
@@ -1618,6 +1618,35 @@ class U2PddPurchaseAdapterTest(unittest.TestCase):
|
||||
self.assertIn("purchase_select_size", operations)
|
||||
adapter.close()
|
||||
|
||||
def test_failed_option_stage_is_recorded_as_failed(self):
|
||||
cases = (
|
||||
({"color": "不存在的颜色"}, "purchase_select_color"),
|
||||
(
|
||||
{"color": "黑色", "size": "不存在的尺码"},
|
||||
"purchase_select_size",
|
||||
),
|
||||
)
|
||||
for options, expected_operation in cases:
|
||||
with self.subTest(operation=expected_operation):
|
||||
device = FakeDevice()
|
||||
adapter = self._adapter(device, [])
|
||||
records = []
|
||||
trace = TaskPerformanceTrace(sink=records.append)
|
||||
trace.bind_task(f"PUR-{expected_operation}")
|
||||
adapter.open_goods(GOODS_URL)
|
||||
|
||||
with trace.activate(), self.assertRaises(PddPurchaseError):
|
||||
adapter.select_options(options)
|
||||
|
||||
matching = [
|
||||
record
|
||||
for record in records
|
||||
if record["operation"] == expected_operation
|
||||
]
|
||||
self.assertEqual(len(matching), 1)
|
||||
self.assertEqual(matching[0]["result"], "failed")
|
||||
adapter.close()
|
||||
|
||||
def test_same_quantity_does_not_focus_editor(self):
|
||||
device = FakeDevice()
|
||||
adapter = self._adapter(device, [])
|
||||
|
||||
Reference in New Issue
Block a user