Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add test for stock location delete confirmation view
Jakub Draganekd167f733e2b2
diff --git a/tests/conftest.py b/tests/conftest.pyindex 582e380225..7d0a528e81 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -156,6 +156,12 @@ def product_in_stock(product_class, default_category):return product+def stock_location():+ warehouse_1 = StockLocation.objects.create(name='Warehouse 1')+ return warehouse_1++@pytest.fixturedef unavailable_product(product_class, default_category):product = Product.objects.create(diff --git a/tests/dashboard/test_product.py b/tests/dashboard/test_product.pyindex e29888f1d5..910286fd36 100644--- a/tests/dashboard/test_product.py+++ b/tests/dashboard/test_product.py@@ -12,7 +12,7 @@ from saleor.dashboard.product.forms import (ProductClassForm,ProductClassSelectorForm,ProductForm)from saleor.product.models import (Product, ProductAttribute, ProductClass,- ProductVariant, Stock)+ ProductVariant, Stock, StockLocation)HTTP_STATUS_OK = 200@@ -224,3 +224,12 @@ def test_view_stock_delete(admin_client, product_in_stock):response = admin_client.post(url)assert response.status_code == HTTP_REDIRECTIONassert not Stock.objects.filter(pk=stock.pk)+++def test_view_stock_location_not_deleted_before_confirmation(admin_client, stock_location):+ url = reverse('dashboard:product-stock-location-delete',+ kwargs={'location_pk':stock_location.pk})+ response = admin_client.get(url)+ assert response.status_code == HTTP_STATUS_OK+ assert StockLocation.objects.filter(pk=stock_location.pk)+