Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update tests
michal04bbaeeac888
diff --git a/tests/conftest.py b/tests/conftest.pyindex fc2432cce4..35e5ba15bf 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -256,6 +256,25 @@ def product_in_stock(product_class, default_category):return product+def product_list(product_class, default_category):+ product_attr = product_class.product_attributes.first()+ attr_value = product_attr.values.first()+ attributes = {smart_text(product_attr.pk): smart_text(attr_value.pk)}++ product_1 = Product.objects.create(+ name='Test product 1', price=Decimal('10.00'),+ product_class=product_class, attributes=attributes)+ product_1.categories.add(default_category)++ product_2 = Product.objects.create(+ name='Test product 2', price=Decimal('20.00'),+ product_class=product_class, attributes=attributes)+ product_2.categories.add(default_category)++ return [product_1, product_2]++@pytest.fixturedef stock_location():warehouse_1 = StockLocation.objects.create(name='Warehouse 1')diff --git a/tests/test_product.py b/tests/test_product.pyindex 9c4cf58869..caf75af544 100644--- a/tests/test_product.py+++ b/tests/test_product.py@@ -415,15 +415,13 @@ def test_product_filter_form(authorized_client, product_in_stock,def test_product_filter_sorted_by_price_descending(- authorized_client, product_in_stock, default_category):- products = models.Product.objects.all()+ authorized_client, product_list, default_category):+ products = models.Product.objects.all().order_by('-price')url = reverse('product:category', kwargs={'path': default_category.slug,'category_id': default_category.pk})data = {'sort_by': '-price'}response = authorized_client.get(url, data)- assert 'price' in response.context['filter'].form.fields.keys()- assert 'sort_by' in response.context['filter'].form.fields.keys()assert list(response.context['filter'].qs) == list(products)@@ -434,6 +432,4 @@ def test_product_filter_sorted_by_wrong_parameter('category_id': default_category.pk})data = {'sort_by': 'aaa'}response = authorized_client.get(url, data)- assert 'price' in response.context['filter'].form.fields.keys()- assert 'sort_by' in response.context['filter'].form.fields.keys()assert not list(response.context['filter'].qs)