Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Drop unused get_available_quantity method
IKarbowiakd1977f696f7f
diff --git a/saleor/warehouse/availability.py b/saleor/warehouse/availability.pyindex a60f1bea77..5f3682fe79 100644--- a/saleor/warehouse/availability.py+++ b/saleor/warehouse/availability.py@@ -76,14 +76,6 @@ def check_stock_quantity_bulk(variants, country_code, quantities):raise InsufficientStock(insufficient_stocks)-def get_available_quantity(variant: "ProductVariant", country_code: str) -> int:- """Return available quantity for given product in given country."""- stocks = Stock.objects.get_variant_stocks_for_country(country_code, variant)- if not stocks:- return 0- return _get_available_quantity(stocks)--def is_product_in_stock(product: "Product", country_code: str, channel_slug: str) -> bool:diff --git a/saleor/warehouse/tests/test_stock_availability.py b/saleor/warehouse/tests/test_stock_availability.pyindex ddabbb4c7b..a794bccfa4 100644--- a/saleor/warehouse/tests/test_stock_availability.py+++ b/saleor/warehouse/tests/test_stock_availability.py@@ -2,11 +2,10 @@ import pytestfrom ...core.exceptions import InsufficientStockfrom ..availability import (+ _get_available_quantity,check_stock_quantity,check_stock_quantity_bulk,- get_available_quantity,)-from ..models import AllocationCOUNTRY_CODE = "US"@@ -46,36 +45,10 @@ def test_check_stock_quantity_without_one_stock(variant_with_many_stocks):assert check_stock_quantity(variant_with_many_stocks, COUNTRY_CODE, 4) is None-def test_get_available_quantity_without_allocation(order_line, stock):- assert not Allocation.objects.filter(order_line=order_line, stock=stock).exists()- available_quantity = get_available_quantity(order_line.variant, COUNTRY_CODE)- assert available_quantity == stock.quantity---def test_get_available_quantity(variant_with_many_stocks):- available_quantity = get_available_quantity(variant_with_many_stocks, COUNTRY_CODE)- assert available_quantity == 7---def test_get_available_quantity_with_allocations(- variant_with_many_stocks,- order_line_with_allocation_in_many_stocks,- order_line_with_one_allocation,-):- available_quantity = get_available_quantity(variant_with_many_stocks, COUNTRY_CODE)- assert available_quantity == 3---def test_get_available_quantity_without_stocks(variant_with_many_stocks):- variant_with_many_stocks.stocks.all().delete()- available_quantity = get_available_quantity(variant_with_many_stocks, COUNTRY_CODE)- assert available_quantity == 0--def test_check_stock_quantity_bulk(variant_with_many_stocks):variant = variant_with_many_stockscountry_code = "US"- available_quantity = get_available_quantity(variant, country_code)+ available_quantity = _get_available_quantity(variant.stocks.all())# test that it doesn't raise error for available quantityassert (