def test_check_stock_quantity_with_allocations(
    variant_with_many_stocks,
    order_line_with_allocation_in_many_stocks,
    order_line_with_one_allocation,
):
    assert check_stock_quantity(variant_with_many_stocks, COUNTRY_CODE,
                                3) is None
def test_check_stock_quantity_without_one_stock(variant_with_many_stocks):
    variant_with_many_stocks.stocks.get(quantity=3).delete()
    assert check_stock_quantity(variant_with_many_stocks, COUNTRY_CODE,
                                4) is None
def test_check_stock_quantity_without_stocks(variant_with_many_stocks):
    variant_with_many_stocks.stocks.all().delete()
    with pytest.raises(InsufficientStock):
        check_stock_quantity(variant_with_many_stocks, COUNTRY_CODE, 1)
def test_check_stock_quantity_with_allocations_out_of_stock(
        variant_with_many_stocks, order_line_with_allocation_in_many_stocks):
    with pytest.raises(InsufficientStock):
        check_stock_quantity(variant_with_many_stocks, COUNTRY_CODE, 5)
def test_check_stock_quantity_out_of_stock(variant_with_many_stocks):
    with pytest.raises(InsufficientStock):
        check_stock_quantity(variant_with_many_stocks, COUNTRY_CODE, 8)
def test_check_stock_quantity(variant_with_many_stocks):
    assert check_stock_quantity(variant_with_many_stocks, COUNTRY_CODE,
                                7) is None
Ejemplo n.º 7
0
def test_check_stock_quantity_is_not_sufficient(product):
    stock = Stock.objects.get()
    variant = stock.product_variant
    new_quantity = stock.quantity_available + 1
    with pytest.raises(InsufficientStock):
        check_stock_quantity(variant, COUNTRY_CODE, new_quantity)
Ejemplo n.º 8
0
def test_check_stock_quantity_is_lower_than_available(product):
    stock = Stock.objects.get()
    variant = stock.product_variant
    new_quantity = stock.quantity_available
    assert check_stock_quantity(variant, COUNTRY_CODE, new_quantity) is None