fix(client): accept confirmed T-107 panel profile
This commit is contained in:
@@ -52,8 +52,10 @@ from cmbuyer_client.pdd.quantity_gate2 import (
|
||||
SERIAL = "192.168.0.173:5555"
|
||||
FIXTURES = Path(__file__).with_name("fixtures")
|
||||
PANEL_FIXTURE = FIXTURES / "final_submit_panel_8_17_0.xml"
|
||||
SHIFTED_PANEL_FIXTURE = FIXTURES / "final_submit_panel_shifted_8_17_0.xml"
|
||||
EXIT_FIXTURE = FIXTURES / "final_submit_panel_exit_8_17_0.xml"
|
||||
PANEL = PANEL_FIXTURE.read_text(encoding="utf-8")
|
||||
SHIFTED_PANEL = SHIFTED_PANEL_FIXTURE.read_text(encoding="utf-8")
|
||||
EXIT = EXIT_FIXTURE.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
@@ -119,6 +121,23 @@ class FinalSubmitPanelObserverTests(unittest.TestCase):
|
||||
self.assertTrue(observation.nearest_clickable_ancestor_unique)
|
||||
self.assertEqual(observation.quantity_read, 2)
|
||||
|
||||
def test_each_human_confirmed_exact_panel_profile_is_accepted_independently(self) -> None:
|
||||
for raw in (PANEL, SHIFTED_PANEL):
|
||||
with self.subTest(panel_bounds=ElementTree.fromstring(raw)[0].get("bounds")):
|
||||
observation = _observe(raw)
|
||||
self.assertEqual(observation.gate2_panel_total_price, "32.76")
|
||||
self.assertEqual(observation.gate3_submit_amount, "32.76")
|
||||
|
||||
def test_panel_profiles_cannot_be_ranged_or_mixed(self) -> None:
|
||||
cases = (
|
||||
SHIFTED_PANEL.replace("[0,474][1080,861]", "[0,475][1080,862]"),
|
||||
SHIFTED_PANEL.replace("[396,582][1053,644]", "[396,659][1053,721]"),
|
||||
PANEL.replace("[396,827][645,902]", "[396,750][645,825]"),
|
||||
)
|
||||
for raw in cases:
|
||||
with self.subTest(), self.assertRaises(FinalSubmitPanelError):
|
||||
_observe(raw)
|
||||
|
||||
def test_dynamic_canonical_amount_is_allowed_only_when_both_roles_and_gate2_agree(self) -> None:
|
||||
raw = PANEL.replace("快卖完 ¥32.76", "快卖完 ¥39.99").replace(
|
||||
"提交订单 ¥32.76", "提交订单 ¥39.99"
|
||||
@@ -675,7 +694,10 @@ class FinalSubmitPanelStaticBoundaryTests(unittest.TestCase):
|
||||
self.assertNotIn(token, source)
|
||||
|
||||
def test_fixtures_contain_no_unrelated_personal_or_payment_data(self) -> None:
|
||||
combined = PANEL_FIXTURE.read_text(encoding="utf-8") + EXIT_FIXTURE.read_text(encoding="utf-8")
|
||||
combined = "".join(
|
||||
path.read_text(encoding="utf-8")
|
||||
for path in (PANEL_FIXTURE, SHIFTED_PANEL_FIXTURE, EXIT_FIXTURE)
|
||||
)
|
||||
for forbidden in ("手机号", "收货地址", "支付密码", "微信支付", "支付宝"):
|
||||
self.assertNotIn(forbidden, combined)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user