From 6d335619d823cf72a8c78ad3219499c0899a112e Mon Sep 17 00:00:00 2001 From: Vishal Katyal Date: Sat, 8 Aug 2026 17:43:23 -0400 Subject: [PATCH] fix: accept 200 alongside 201 for checkout creation in test_buyer_consent test_buyer_consent asserts an exact 201 for POST /checkout-sessions (business_logic_test.py:432), while the rest of the suite accepts [200, 201] for the identical operation. This is an internal inconsistency: 200 is a spec-legitimate outcome for this endpoint, so the exact-201 assert can fail a conformant server. Why 200 is legitimate (pinned 2026-04-08): the status-code table in specification/checkout-rest.md lists both 200 OK and 201 Created as success, neither bound to an endpoint; business outcomes are returned with HTTP 200 and the UCP envelope carrying messages (checkout-rest.md, normative), which applies to the create path; and the Idempotency-Key replay path does not pin a status. source/services/shopping/rest.openapi.json does document 201 as the create success response, but that responses map is non-exhaustive (it lists no 4xx/5xx either), so it is the illustrative happy path, not a MUST forbidding 200. The suite already accepts [200, 201] for this same operation in five sibling sites, including the shared create_checkout_session helper every other test uses: integration_test_utils.py:914, protocol_test.py:328, idempotency_test.py:60, fulfillment_structure_test.py:253, and validation_test.py:87. Line 432 is the sole outlier. The check stays sound: assert_response_status uses assertIn, so any status outside [200, 201] still fails. --- business_logic_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business_logic_test.py b/business_logic_test.py index 957c556..169a866 100644 --- a/business_logic_test.py +++ b/business_logic_test.py @@ -429,7 +429,7 @@ def test_buyer_consent(self): json=create_payload_dict, headers=integration_test_utils.get_headers(), ) - self.assert_response_status(response, 201) + self.assert_response_status(response, [200, 201]) checkout_id = checkout.Checkout(**response.json()).id response = self.client.get(