From 9f7e27a3fe280f4c9ebf52657533cef7eaa22b1e Mon Sep 17 00:00:00 2001 From: "tyrion.lh" Date: Tue, 7 Jul 2026 01:45:44 -0700 Subject: [PATCH] fix(python): update extension checkout imports --- rest/python/server/integration_test.py | 10 ++++---- rest/python/server/models.py | 14 +++++++----- rest/python/server/server_import_test.py | 29 ++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 rest/python/server/server_import_test.py diff --git a/rest/python/server/integration_test.py b/rest/python/server/integration_test.py index c4f31862..7cc5590d 100644 --- a/rest/python/server/integration_test.py +++ b/rest/python/server/integration_test.py @@ -45,14 +45,16 @@ from ucp_sdk.models.schemas.shopping.types import ( payment_instrument as payment_instr_type, ) -from ucp_sdk.models.schemas.shopping.ap2_mandate import Checkout as Ap2Checkout -from ucp_sdk.models.schemas.shopping.buyer_consent import ( +from ucp_sdk.models.schemas.shopping.ap2_mandate.dev.ucp.shopping import ( + Checkout as Ap2Checkout, +) +from ucp_sdk.models.schemas.shopping.buyer_consent.dev.ucp.shopping import ( Checkout as BuyerConsentCheckoutResp, ) -from ucp_sdk.models.schemas.shopping.discount import ( +from ucp_sdk.models.schemas.shopping.discount.dev.ucp.shopping import ( Checkout as DiscountCheckoutResp, ) -from ucp_sdk.models.schemas.shopping.fulfillment import ( +from ucp_sdk.models.schemas.shopping.fulfillment.dev.ucp.shopping import ( Checkout as FulfillmentCheckout, ) from ucp_sdk.models.schemas.shopping.order import PlatformSchema diff --git a/rest/python/server/models.py b/rest/python/server/models.py index e1197c02..0547f0e0 100644 --- a/rest/python/server/models.py +++ b/rest/python/server/models.py @@ -20,17 +20,19 @@ """ from typing import Any -from ucp_sdk.models.schemas.shopping.ap2_mandate import Checkout as Ap2Checkout -from ucp_sdk.models.schemas.shopping.buyer_consent import ( +from ucp_sdk.models.schemas.shopping.ap2_mandate.dev.ucp.shopping import ( + Checkout as Ap2Checkout, +) +from ucp_sdk.models.schemas.shopping.buyer_consent.dev.ucp.shopping import ( Checkout as BuyerConsentCheckoutResp, ) -from ucp_sdk.models.schemas.shopping.discount import ( +from ucp_sdk.models.schemas.shopping.discount import DiscountsObject +from ucp_sdk.models.schemas.shopping.discount.dev.ucp.shopping import ( Checkout as DiscountCheckoutResp, - DiscountsObject, ) -from ucp_sdk.models.schemas.shopping.fulfillment import ( +from ucp_sdk.models.schemas.shopping.fulfillment import Fulfillment +from ucp_sdk.models.schemas.shopping.fulfillment.dev.ucp.shopping import ( Checkout as FulfillmentCheckout, - Fulfillment, ) from ucp_sdk.models.schemas.shopping.order import Order diff --git a/rest/python/server/server_import_test.py b/rest/python/server/server_import_test.py new file mode 100644 index 00000000..8d24e18a --- /dev/null +++ b/rest/python/server/server_import_test.py @@ -0,0 +1,29 @@ +# Copyright 2026 UCP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Smoke tests for the sample server module.""" + +import importlib +from pathlib import Path +import sys + + +def test_server_module_imports(monkeypatch) -> None: + """The sample server should import with the current Python SDK models.""" + monkeypatch.syspath_prepend(str(Path(__file__).parent)) + sys.modules.pop("server", None) + + server = importlib.import_module("server") + + assert server.app is not None