Repository navigation
test(shopping): verify totals by the spec's formula, skip without the simulate-shipping hook - #139
Open
segiodongo wants to merge 1 commit into
Conversation
… simulate-shipping hook
Check in test_fulfillment_flow that fulfillment entries sum to the selected option's cost and that overall totals satisfy assert_totals_consistent instead of assuming price + shipping without tax or fees. Probe /testing/simulate-shipping/{order_id} in SecurityTest so servers without the sample-server hook skip on 404/405 and mismatched --simulation_secret skips on 403.
segiodongo
force-pushed
the
upstream/u3-fulfillment-totals-and-sim-skip
branch
from
November 18, 2026 20:16
e7cdc3b to
3aa6ddd
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 two test assumptions that caused false failures against spec-compliant servers outside the bundled Flower Shop sample:
test_fulfillment_flow): Previously,test_fulfillment_flowassertedtotal == item_price + option_cost, failing against any server that includestaxorfeeentries on the checkout. It now verifies that thefulfillmenttotal entries sum to the selected option's cost and checks the overall breakdown viaassert_totals_consistent(sum(entries where type != "total") == total, percheckout/index.md"Verification").simulation_url_security_testwhen/testing/simulate-shipping/{id}is absent:POST /testing/simulate-shipping/{order_id}is a sample-server test hook rather than a UCP specification endpoint, so servers without it previously failed all threeSecurityTestmethods. Matchingtest_update_event_is_full_order_entityinwebhook_structure_test.py,SecurityTestnow probes the hook with the configured secret when needed and skips on404/405(no simulation hook) or403(mismatched--simulation_secret), while still treating an unauthenticated404as a valid refusal when the probe confirms the hook exists.tests/fulfillment_and_simulation_test.pycovering tax-bearing checkouts and simulation-hook skip/refusal paths, and wiresuv run pytest testsinto CI.Verification
uv run pytest tests: 6 passeduv run ucp-conformance --suite=allagainst the Flower Shop sample server: 83 executed, 81 passed, 2 skipped, 0 failures, 0 errorsType of change
Checklist