def test_can_finalize_draft_order_wrong_shipping(order_with_lines): order = order_with_lines shipping_zone = order.shipping_method.shipping_zone shipping_zone.countries = ['DE'] shipping_zone.save() assert order.shipping_address.country.code not in shipping_zone.countries errors = can_finalize_draft_order(order, []) msg = 'Shipping method is not valid for chosen shipping address' assert errors[0].message == msg
def test_can_finalize_draft_order_wrong_shipping(order_with_lines): order = order_with_lines shipping_zone = order.shipping_method.shipping_zone shipping_zone.countries = ['DE'] shipping_zone.save() assert order.shipping_address.country.code not in shipping_zone.countries errors = can_finalize_draft_order(order, []) msg = 'Shipping method is not valid for chosen shipping address' assert errors[0].message == msg
def test_can_finalize_draft_order_non_existing_variant(order_with_lines): order = order_with_lines line = order.lines.first() variant = line.variant variant.delete() line.refresh_from_db() assert line.variant is None errors = can_finalize_draft_order(order, []) assert (errors[0].message == 'Could not create orders with non-existing products.')
def test_can_finalize_draft_order_non_existing_variant(order_with_lines): order = order_with_lines line = order.lines.first() variant = line.variant variant.delete() line.refresh_from_db() assert line.variant is None errors = can_finalize_draft_order(order, []) assert ( errors[0].message == 'Could not create orders with non-existing products.')
def test_can_finalize_draft_order_no_order_lines(order): errors = can_finalize_draft_order(order, []) assert errors[0].message == 'Could not create order without any products.'
def test_can_finalize_draft_order(order_with_lines): errors = can_finalize_draft_order(order_with_lines, []) assert not errors
def test_can_finalize_draft_order_no_order_lines(order): errors = can_finalize_draft_order(order, []) assert errors[0].message == 'Could not create order without any products.'
def test_can_finalize_draft_order(order_with_lines): errors = can_finalize_draft_order(order_with_lines, []) assert not errors