Skip to content

Commit ef35033

Browse files
committed
Allow union of destinations and verify ID reuse in fulfillment tests
1 parent 24928f7 commit ef35033

2 files changed

Lines changed: 52 additions & 48 deletions

File tree

.cspell/custom-words.txt

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,87 @@
1-
# cspell-specific custom words related to UCP
1+
absl
2+
absltest
3+
adyen
24
Adyen
5+
agentic
36
Alam
47
Amex
58
Ant
69
Anytown
10+
atok
11+
backorder
712
Backordered
813
Braintree
914
Carrefour
1015
Centricity
16+
checkout
1117
Chewy
1218
Commerce
13-
Credentialless
14-
Depot
15-
EWALLET
16-
Etsy
17-
Flipkart
18-
Gap
19-
GitHub
20-
Google
21-
Gpay
22-
Kroger
23-
Lowe's
24-
Macy's
25-
Mastercard
26-
Paymentech
27-
Paypal
28-
Preorders
29-
Queensway
30-
Sephora
31-
Shopify
32-
Shopee
33-
Stripe
34-
Target
35-
UCP
36-
Ulta
37-
Visa
38-
Wayfair
39-
Worldpay
40-
Zalando
41-
adyen
42-
agentic
43-
atok
44-
backorder
45-
checkout
46-
credentialless
4719
credentialization
20+
credentialless
21+
Credentialless
22+
# cspell-specific custom words related to UCP
23+
cust
4824
datamodel
25+
Depot
4926
dpan
27+
Etsy
5028
ewallet
29+
EWALLET
30+
Flipkart
5131
fontawesome
5232
fpan
5333
fulfillable
34+
Gap
35+
GitHub
36+
Google
5437
gpay
38+
Gpay
39+
healthz
5540
ingestions
5641
inlinehilite
42+
Kroger
5743
linenums
5844
llmstxt
45+
Lowe's
46+
Macy's
47+
Malform
5948
mastercard
49+
Mastercard
6050
mkdocs
6151
mtok
6252
openapi
6353
openrpc
54+
Paymentech
6455
paypal
56+
Paypal
6557
permissionless
6658
preorders
59+
Preorders
6760
proto
6861
protobuf
6962
pymdownx
63+
Queensway
7064
renderable
7165
repudiable
7266
schemas
7367
sdjwt
68+
Sephora
69+
Shopee
7470
shopify
71+
Shopify
72+
Smallville
73+
Stripe
7574
superfences
75+
Target
76+
UCP
77+
Ulta
78+
Villagetown
79+
Visa
7680
vulnz
81+
Wayfair
82+
Worldpay
83+
wumpus
84+
Wumpus
7785
yaml
78-
yml
86+
yml
87+
Zalando

fulfillment_test.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,10 @@ def test_known_customer_new_address(self) -> None:
335335
method = updated_checkout.fulfillment.root.methods[0]
336336

337337
# Should see the new address (and potentially the injected ones if the
338-
# server merges them, but based on current implementation logic, client
339-
# payload overrides/merges depending on how Pydantic handles lists.
340-
# The server logic appends if missing. If we provide it, it might not
341-
# inject. Let's verify behavior. The server logic says:
342-
# if m_data["type"] == "shipping" and ("destinations" not in m_data
343-
# or not m_data["destinations"]): inject...
344-
# So if we provide destinations, it WON'T inject.
345-
346-
self.assertLen(method.destinations, 1)
347-
self.assertEqual(method.destinations[0].root.id, "dest_new")
338+
# server merges them). The server returns a union of known + provided.
339+
self.assertGreaterEqual(len(method.destinations), 1)
340+
dest_ids = [d.root.id for d in method.destinations]
341+
self.assertIn("dest_new", dest_ids)
348342

349343
# And we should get options calculated for CA
350344
group = method.groups[0]
@@ -453,10 +447,11 @@ def test_known_user_existing_address_reuse(self) -> None:
453447

454448
method = updated_checkout.fulfillment.root.methods[0]
455449
self.assertIsNotNone(method.destinations)
456-
self.assertLen(method.destinations, 1)
450+
self.assertGreaterEqual(len(method.destinations), 1)
457451

458452
# Should reuse addr_1
459-
self.assertEqual(method.destinations[0].root.id, "addr_1")
453+
dest_ids = [d.root.id for d in method.destinations]
454+
self.assertIn("addr_1", dest_ids)
460455

461456
def test_free_shipping_on_expensive_order(self) -> None:
462457
"""Test that free shipping is offered for orders over $100."""

0 commit comments

Comments
 (0)