Example #1
0
def test_ready_to_place_order_no_shipping_method(cart_with_item, address):
    checkout = cart_with_item
    checkout.shipping_address = address
    checkout.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert not ready
    assert error == 'Shipping method is not set'
Example #2
0
def test_ready_to_place_order_no_shipping_method(cart_with_item, address):
    checkout = cart_with_item
    checkout.shipping_address = address
    checkout.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert not ready
    assert error == 'Shipping method is not set'
Example #3
0
def test_checkout_complete_no_shipping_addres(
        cart_with_item, shipping_method):
    checkout = cart_with_item
    checkout.shipping_method = shipping_method
    checkout.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert not ready
    assert error == 'Shipping address is not set'
Example #4
0
def test_ready_to_place_order_no_payment(cart_with_item, shipping_method,
                                         address):
    checkout = cart_with_item
    checkout.shipping_address = address
    checkout.shipping_method = shipping_method
    checkout.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert not ready
    assert error == 'Checkout is not fully paid'
Example #5
0
def test_ready_to_place_order_no_billing_address(cart_with_item, address,
                                                 shipping_method):
    checkout = cart_with_item
    checkout.shipping_address = address
    checkout.shipping_method = shipping_method
    checkout.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert not ready
    assert error == 'Billing address is not set'
Example #6
0
def test_ready_to_place_order_no_billing_address(
        cart_with_item, address, shipping_method):
    checkout = cart_with_item
    checkout.shipping_address = address
    checkout.shipping_method = shipping_method
    checkout.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert not ready
    assert error == 'Billing address is not set'
Example #7
0
def test_ready_to_place_order_invalid_shipping_method(
        cart_with_item, address, shipping_zone_without_countries):
    checkout = cart_with_item
    checkout.shipping_address = address
    shipping_method = shipping_zone_without_countries.shipping_methods.first()
    checkout.shipping_method = shipping_method
    checkout.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert not ready
    assert error == 'Shipping method is not valid for your shipping address'
Example #8
0
def test_ready_to_place_order_invalid_shipping_method(
        cart_with_item, address, shipping_zone_without_countries):
    checkout = cart_with_item
    checkout.shipping_address = address
    shipping_method = shipping_zone_without_countries.shipping_methods.first()
    checkout.shipping_method = shipping_method
    checkout.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert not ready
    assert error == 'Shipping method is not valid for your shipping address'
Example #9
0
def test_ready_to_place_order_no_payment(cart_with_item, shipping_method,
                                         address):
    checkout = cart_with_item
    checkout.shipping_address = address
    checkout.shipping_method = shipping_method
    checkout.billing_address = address
    checkout.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert not ready
    assert error == ('Provided payment methods can not '
                     'cover the checkout\'s total amount')
Example #10
0
def test_ready_to_place_order_no_payment(
        cart_with_item, shipping_method, address):
    checkout = cart_with_item
    checkout.shipping_address = address
    checkout.shipping_method = shipping_method
    checkout.billing_address = address
    checkout.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert not ready
    assert error == (
        'Provided payment methods can not '
        'cover the checkout\'s total amount')
Example #11
0
def test_ready_to_place_order(cart_with_item, payment_dummy, address,
                              shipping_method):
    checkout = cart_with_item
    checkout.shipping_address = address
    checkout.shipping_method = shipping_method
    checkout.save()
    total = checkout.get_total()
    payment = payment_dummy
    payment.is_active = True
    payment.order = None
    payment.total = total.gross.amount
    payment.currency = total.gross.currency
    payment.checkout = checkout
    payment.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert ready
    assert not error
Example #12
0
def test_ready_to_place_order(
        cart_with_item, payment_dummy, address, shipping_method):
    checkout = cart_with_item
    checkout.shipping_address = address
    checkout.shipping_method = shipping_method
    checkout.billing_address = address
    checkout.save()
    total = checkout.get_total()
    payment = payment_dummy
    payment.is_active = True
    payment.order = None
    payment.total = total.gross.amount
    payment.currency = total.gross.currency
    payment.checkout = checkout
    payment.save()
    ready, error = ready_to_place_order(checkout, None, None)
    assert ready
    assert not error