Repository navigation
fix(shopping): complete checkouts with a buyer and check the outcome - #138
Open
segiodongo wants to merge 1 commit into
Open
segiodongo wants to merge 1 commit into
segiodongo wants to merge 1 commit into
Conversation
Hoist DEFAULT_BUYER to ShoppingIntegrationTestBase, ensure a buyer and poll complete_in_progress in complete_checkout_session, fail with the server's own status and messages[] when no order is placed, send only Create Checkout request inputs with spec field names, guard omitted optional payment on Update Checkout via checkout_update_payload, skip test_webhook_event_stream when /testing/simulate-shipping is absent, and add strict-store unit tests.
segiodongo
force-pushed
the
upstream/u1-complete-with-buyer
branch
from
November 18, 2026 20:15
53887b7 to
7e1f914
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes several assumptions in the shopping checkout creation, update, and completion helpers that caused tests to fail or crash before reaching their assertions against spec-compliant servers outside the bundled Flower Shop sample:
status: "incomplete"with a recoverable error at$.buyer.emailwhen none is supplied). Previously,create_completed_orderandcomplete_checkout_sessioncreated checkouts without a buyer, asserted only HTTP 200 on Complete Checkout, and indexed["order"]["id"]unconditionally — turning any recoverable completion refusal intoKeyError: 'order'.DEFAULT_BUYERtoShoppingIntegrationTestBase.create_completed_orderpasses it on Create Checkout;complete_checkout_sessionadds it via Update Checkout when absent, polls Get Checkout if the server returnsstatus: "complete_in_progress", and fails with an actionable message quoting the server'sstatusandmessages[]when no order is placed. Tests that inspect raw completion responses useattempt_complete_checkout.test_idempotency_completenow completes a checkout that actually places an order and verifies that an order resulted, rather than passing when two completions return identical refusals.test_payment_failurecreates its checkout with a buyer so servers that require one reach payment validation instead of failing earlier on missing buyer info.create_checkout_payloadpreviously sentlocality/regioninstead ofaddress_locality/address_region(also fixed intest_update_checkout), preselected the sample server's"std-ship"option ID, and attached response-only fields (id,status,currency,totals,links, invented line-item and group IDs). It now sends only valid Create Checkout request inputs and logs any unexpectedtype: "error"messages vianote_error_messages.paymentand carried-over instruments on Update Checkout: Extractscheckout_update_payload(converting carried-over responseSelectedPaymentInstrumentmodels to JSON soPaymentUpdateRequestvalidation succeeds) and uses it where tests previously readcheckout_obj.payment.instrumentsdirectly without guardingpayment is None.test_webhook_event_streamwhen/testing/simulate-shipping/{id}is absent: Matchestest_update_event_is_full_order_entityinwebhook_structure_test.pyby skipping on404/405(no simulation hook) or403(mismatched--simulation_secret).tests/strict_store.py(an in-memoryhttpx.MockTransportstore requiring a buyer, omitting optionalpayment, generating its own shipping options, and supportingcomplete_in_progress) andtests/completion_test.py, and wiresuv run pytest testsinto CI while keeping barepytestscoped tocore,common, andshopping.Verification
uv run pytest tests: 21 passeduv run ucp-conformance --suite=allagainst the Flower Shop sample server: 83 executed, 81 passed, 2 skipped, 0 failures, 0 errorsType of change
Checklist