Esempio n. 1
0
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'
Esempio n. 2
0
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'
Esempio n. 3
0
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()
Esempio n. 4
0
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()
Esempio n. 5
0
def test_checkout_create_order_insufficient_stock(
        request_cart, customer_user, product_in_stock, billing_address,
        shipping_method):
    product_class = product_in_stock.product_class
    product_class.is_shipping_required = False
    product_class.save()
    customer_user.default_billing_address = billing_address
    customer_user.save()
    variant = product_in_stock.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()