本文整理匯總了Python中saleor.checkout.core.Checkout.for_storage方法的典型用法代碼示例。如果您正苦於以下問題:Python Checkout.for_storage方法的具體用法?Python Checkout.for_storage怎麽用?Python Checkout.for_storage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類saleor.checkout.core.Checkout
的用法示例。
在下文中一共展示了Checkout.for_storage方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_index_view
# 需要導入模塊: from saleor.checkout.core import Checkout [as 別名]
# 或者: from saleor.checkout.core.Checkout import for_storage [as 別名]
def test_index_view(cart, status_code, url, rf):
checkout = Checkout(cart, AnonymousUser(), 'tracking_code')
request = rf.get('checkout:index')
request.user = checkout.user
request.session = {STORAGE_SESSION_KEY: checkout.for_storage()}
request.discounts = []
response = views.index_view(request, checkout, checkout.cart)
assert response.status_code == status_code
assert response.url == url
示例2: test_index_view
# 需要導入模塊: from saleor.checkout.core import Checkout [as 別名]
# 或者: from saleor.checkout.core.Checkout import for_storage [as 別名]
def test_index_view(cart, status_code, url, rf, monkeypatch):
checkout = Checkout(cart, AnonymousUser(), 'tracking_code')
request = rf.get('checkout:index')
request.user = checkout.user
request.session = {STORAGE_SESSION_KEY: checkout.for_storage()}
request.discounts = []
monkeypatch.setattr(
'saleor.cart.utils.get_cart_from_request', lambda req, qs: cart)
response = views.index_view(request)
assert response.status_code == status_code
assert response.url == url
示例3: test_checkout_version
# 需要導入模塊: from saleor.checkout.core import Checkout [as 別名]
# 或者: from saleor.checkout.core.Checkout import for_storage [as 別名]
def test_checkout_version():
checkout = Checkout(Mock(), AnonymousUser(), 'tracking_code')
storage = checkout.for_storage()
assert storage['version'] == Checkout.VERSION