Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Refactor tests
michalf12ea5d18f42
diff --git a/templates/category/index.html b/templates/category/index.htmlindex 70906c2414..8d12869df9 100644--- a/templates/category/index.html+++ b/templates/category/index.html@@ -1,6 +1,6 @@{% extends "base.html" %}{% load i18n %}-{% load slice from shop %}+{% load shop %}{% load staticfiles %}{% load bootstrap_pagination from bootstrap3 %}{% load render_bundle from webpack_loader %}@@ -42,7 +42,6 @@</div><div class="col-md-5"><div class="row">- {% with filter.form.sort_by as field %}<div class="col-6 col-md-2 col-lg-6 filters-menu"><span class="filters-menu__label hidden-sm-up">Filters</span><span class="filters-menu__icon hidden-sm-up"></span>@@ -51,16 +50,20 @@<div class="col-6 col-md-10 col-lg-6"><div class="sort-by"><div class="click-area hide"></div>- <button class="btn btn-link">+ <!--<button class="btn btn-link">--><div>- <span>{{ field.label }}:<strong>{{ field }}</strong></span>+ <span>Sort by:+ <strong>+ <a href="{% get_sort_by_url 'name' %}">{% trans "name" %}</a>+ <a href="{% get_sort_by_url 'price' %}">{% trans "price" %}</a>+ </strong>+ </span><div class="sort-order-icon"></div></div>- </button>+ <!--</button>--></div></div>- {% endwith %}</div></div></div>@@ -85,7 +88,7 @@<div class="product-filters__attributes"><form method="get">{% for field in filter.form %}- {% if field.label != 'Sort by' %}+<div key={{ attribute.pk }}><h3 onClick="">{{ field.label }}@@ -95,7 +98,7 @@</h3>{{ field }}</div>- {% endif %}+{% endfor %}<button type="submit">Search</button></form>diff --git a/tests/test_product.py b/tests/test_product.pyindex aece29640e..ea144079f9 100644--- a/tests/test_product.py+++ b/tests/test_product.py@@ -374,8 +374,9 @@ def test_variant_availability_status(unavailable_product):def test_product_filter_empty_get(authorized_client, product_in_stock,default_category):products = models.Product.objects.all()- url = reverse('product:category', args=[default_category.slug,- default_category.pk])+ url = reverse(+ 'product:category', kwargs={'path': default_category.slug,+ 'category_id': default_category.pk})response = authorized_client.get(url)assert list(products) == list(response.context['filter'].qs)@@ -383,18 +384,19 @@ def test_product_filter_empty_get(authorized_client, product_in_stock,def test_product_filter_product_exists(authorized_client, product_in_stock,default_category):products = models.Product.objects.all()- url = reverse('product:category', args=[default_category.slug,- default_category.pk])- data = {u'price_0': [u''], u'price_1': [u'20']}+ url = reverse(+ 'product:category', kwargs={'path': default_category.slug,+ 'category_id': default_category.pk})+ data = {'price_0': [''], 'price_1': ['20']}response = authorized_client.get(url, data)- assert list(products) == list(response.context['filter'].qs)+ assert list(response.context['filter'].qs) == list(products)def test_product_filter_product_not_exists(authorized_client, product_in_stock,default_category):- products = models.Product.objects.all()- url = reverse('product:category', args=[default_category.slug,- default_category.pk])- data = {u'price_0': [u'20'], u'price_1': [u'']}+ url = reverse(+ 'product:category', kwargs={'path': default_category.slug,+ 'category_id': default_category.pk})+ data = {'price_0': ['20'], 'price_1': ['']}response = authorized_client.get(url, data)assert list(response.context['filter'].qs) == []