本文整理汇总了Python中saleor.checkout.core.Checkout类的典型用法代码示例。如果您正苦于以下问题:Python Checkout类的具体用法?Python Checkout怎么用?Python Checkout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Checkout类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_checkout_shipping_method
def test_checkout_shipping_method(shipping_address, shipping_method, value, monkeypatch):
queryset = Mock(get=Mock(return_value=shipping_method))
monkeypatch.setattr(Checkout, 'shipping_address', shipping_address)
monkeypatch.setattr('saleor.checkout.core.ShippingMethodCountry.objects', queryset)
checkout = Checkout(Mock(), AnonymousUser(), 'tracking_code')
checkout.storage['shipping_method_country_id'] = 1
assert checkout.shipping_method == value
开发者ID:fnugrahendi,项目名称:saleor,代码行数:7,代码来源:test_checkout.py
示例2: test_checkout_shipping_method_setter
def test_checkout_shipping_method_setter():
shipping_method = Mock(id=1)
checkout = Checkout(Mock(), AnonymousUser(), 'tracking_code')
assert checkout.modified is False
checkout.shipping_method = shipping_method
assert checkout.modified is True
assert checkout.storage['shipping_method_country_id'] == 1
开发者ID:fnugrahendi,项目名称:saleor,代码行数:7,代码来源:test_checkout.py
示例3: test_checkout_shipping_does_not_exists
def test_checkout_shipping_does_not_exists(monkeypatch):
queryset = Mock(get=Mock(side_effect=ShippingMethodCountry.DoesNotExist))
monkeypatch.setattr(
'saleor.checkout.core.ShippingMethodCountry.objects', queryset)
checkout = Checkout(Mock(), AnonymousUser(), 'tracking_code')
checkout.storage['shipping_method_country_id'] = 1
assert checkout.shipping_method is None
开发者ID:patrys,项目名称:saleor,代码行数:7,代码来源:test_checkout.py
示例4: test_checkout_shipping_address_with_storage
def test_checkout_shipping_address_with_storage(
address_objects, shipping, monkeypatch):
monkeypatch.setattr(
'saleor.checkout.core.Address.objects', address_objects)
checkout = Checkout(Mock(), AnonymousUser(), 'tracking_code')
checkout.storage['shipping_address'] = {'id': 1}
assert checkout.shipping_address == shipping
开发者ID:patrys,项目名称:saleor,代码行数:7,代码来源:test_checkout.py
示例5: test_checkout_shipping_address_setter
def test_checkout_shipping_address_setter():
address = Address(first_name='Jan', last_name='Kowalski')
checkout = Checkout(Mock(), AnonymousUser(), 'tracking_code')
checkout.shipping_address = address
assert checkout.storage['shipping_address'] == {
'city': u'', 'city_area': u'', 'company_name': u'', 'country': '', 'phone': u'',
'country_area': u'', 'first_name': 'Jan', 'id': None, 'last_name': 'Kowalski',
'postal_code': u'', 'street_address_1': u'', 'street_address_2': u''}
开发者ID:fnugrahendi,项目名称:saleor,代码行数:8,代码来源:test_checkout.py
示例6: test_index_view
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
开发者ID:fnugrahendi,项目名称:saleor,代码行数:9,代码来源:test_checkout.py
示例7: test_note_in_created_order
def test_note_in_created_order(request_cart, customer_user, billing_address):
customer_user.default_billing_address = billing_address
checkout = Checkout(request_cart, customer_user, 'tracking_code')
checkout.note = ''
order = checkout.create_order()
assert not order.notes.all()
checkout.note = 'test_note'
order = checkout.create_order()
assert order.notes.values()[0].get('content') == 'test_note'
开发者ID:patrys,项目名称:saleor,代码行数:9,代码来源:test_checkout.py
示例8: test_checkout_create_order_insufficient_stock
def test_checkout_create_order_insufficient_stock(
request_cart, customer_user, product):
product_type = product.product_type
product_type.is_shipping_required = False
product_type.save()
variant = product.variants.get()
request_cart.add(variant, quantity=10, check_quantity=False)
checkout = Checkout(request_cart, customer_user, 'tracking_code')
with pytest.raises(InsufficientStock):
checkout.create_order()
开发者ID:zdobooto,项目名称:saleor,代码行数:10,代码来源:test_checkout.py
示例9: test_index_view
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
开发者ID:patrys,项目名称:saleor,代码行数:11,代码来源:test_checkout.py
示例10: test_checkout_clear_storage
def test_checkout_clear_storage():
checkout = Checkout(Mock(), AnonymousUser(), 'tracking_code')
checkout.storage['new'] = 1
checkout.clear_storage()
assert checkout.storage is None
assert checkout.modified is True
开发者ID:fnugrahendi,项目名称:saleor,代码行数:6,代码来源:test_checkout.py
示例11: test_checkout_version_with_from_storage
def test_checkout_version_with_from_storage(storage_data, expected_storage):
checkout = Checkout.from_storage(
storage_data, Mock(), AnonymousUser(), 'tracking_code')
storage = checkout.for_storage()
assert storage == expected_storage
开发者ID:fnugrahendi,项目名称:saleor,代码行数:5,代码来源:test_checkout.py
示例12: test_checkout_version
def test_checkout_version():
checkout = Checkout(Mock(), AnonymousUser(), 'tracking_code')
storage = checkout.for_storage()
assert storage['version'] == Checkout.VERSION
开发者ID:fnugrahendi,项目名称:saleor,代码行数:4,代码来源:test_checkout.py
示例13: test_checkout_discount
def test_checkout_discount(request_cart, sale, product_in_stock):
variant = product_in_stock.variants.get()
request_cart.add(variant, 1)
checkout = Checkout(request_cart, AnonymousUser(), 'tracking_code')
assert checkout.get_total() == Price(currency="USD", net=5)
开发者ID:patrys,项目名称:saleor,代码行数:5,代码来源:test_checkout.py
示例14: test_checkout_discount
def test_checkout_discount(request_cart, sale, product_in_stock):
variant = product_in_stock.variants.get()
request_cart.add(variant, 1)
checkout = Checkout(request_cart, AnonymousUser(), 'tracking_code')
assert checkout.get_total() == TaxedMoney(
net=Money(5, 'USD'), gross=Money(5, 'USD'))
开发者ID:artursmet,项目名称:saleor,代码行数:6,代码来源:test_checkout.py
注:本文中的saleor.checkout.core.Checkout类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论