コード例 #1
0
ファイル: test_order.py プロジェクト: krzysztofwolski/saleor
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
コード例 #2
0
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
コード例 #3
0
ファイル: test_order.py プロジェクト: vskynet/saleor
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.')
コード例 #4
0
ファイル: test_order.py プロジェクト: krzysztofwolski/saleor
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.')
コード例 #5
0
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.'
コード例 #6
0
def test_can_finalize_draft_order(order_with_lines):
    errors = can_finalize_draft_order(order_with_lines, [])
    assert not errors
コード例 #7
0
ファイル: test_order.py プロジェクト: krzysztofwolski/saleor
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.'
コード例 #8
0
ファイル: test_order.py プロジェクト: krzysztofwolski/saleor
def test_can_finalize_draft_order(order_with_lines):
    errors = can_finalize_draft_order(order_with_lines, [])
    assert not errors