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'
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'
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'
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'
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'
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'
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')
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')
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
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