Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Update tests

michal26e11155c562
diff --git a/tests/test_product.py b/tests/test_product.py
index caf75af544..ce1aa96089 100644
--- a/tests/test_product.py
+++ b/tests/test_product.py
@@ -12,7 +12,8 @@ from saleor.product import (
models, ProductAvailabilityStatus, VariantAvailabilityStatus)
from saleor.product.utils import (
get_attributes_display_map, get_availability,
- get_product_availability_status, get_variant_availability_status)
+ get_product_availability_status, products_with_details,
+ get_variant_availability_status)
from tests.utils import filter_products_by_attribute
@@ -373,7 +374,9 @@ def test_variant_availability_status(unavailable_product):
def test_product_filter_before_filtering(
authorized_client, product_in_stock, default_category):
- products = models.Product.objects.all()
+ products = (models.Product.objects.all()
+ .filter(categories__name=default_category)
+ .order_by('-price'))
url = reverse(
'product:category', kwargs={'path': default_category.slug,
'category_id': default_category.pk})
@@ -383,7 +386,9 @@ def test_product_filter_before_filtering(
def test_product_filter_product_exists(authorized_client, product_in_stock,
default_category):
- products = models.Product.objects.all()
+ products = (models.Product.objects.all()
+ .filter(categories__name=default_category)
+ .order_by('-price'))
url = reverse(
'product:category', kwargs={'path': default_category.slug,
'category_id': default_category.pk})
@@ -399,12 +404,14 @@ def test_product_filter_product_does_not_exists(
'category_id': default_category.pk})
data = {'price_0': ['20'], 'price_1': ['']}
response = authorized_client.get(url, data)
- assert list(response.context['filter'].qs) == []
+ assert not list(response.context['filter'].qs)
def test_product_filter_form(authorized_client, product_in_stock,
default_category):
- products = models.Product.objects.all()
+ products = (models.Product.objects.all()
+ .filter(categories__name=default_category)
+ .order_by('-price'))
url = reverse(
'product:category', kwargs={'path': default_category.slug,
'category_id': default_category.pk})
@@ -415,8 +422,10 @@ def test_product_filter_form(authorized_client, product_in_stock,
def test_product_filter_sorted_by_price_descending(
- authorized_client, product_list, default_category):
- products = models.Product.objects.all().order_by('-price')
+ authorized_client, product_list, default_category):
+ products = (models.Product.objects.all()
+ .filter(categories__name=default_category)
+ .order_by('-price'))
url = reverse(
'product:category', kwargs={'path': default_category.slug,
'category_id': default_category.pk})