Skip to content

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

WIP

Pacu22977e4e1aa29
diff --git a/tests/dashboard/test_order.py b/tests/dashboard/test_order.py
index a8fa771a72..fa9d4a77c5 100644
--- a/tests/dashboard/test_order.py
+++ b/tests/dashboard/test_order.py
@@ -5,7 +5,8 @@ import pytest
from django.urls import reverse
from payments import PaymentStatus
from prices import Money, TaxedMoney
-from tests.utils import get_redirect_location, get_url_path
+
+from tests.utils import get_redirect_location
from saleor.dashboard.order.forms import ChangeQuantityForm, OrderNoteForm
from saleor.dashboard.order.utils import fulfill_order_line
@@ -458,7 +459,7 @@ def test_view_change_order_line_quantity(
redirected_to, redirect_status_code = response.redirect_chain[-1]
# check redirection
assert redirect_status_code == 302
- assert get_url_path(redirected_to) == reverse(
+ assert redirected_to == reverse(
'dashboard:order-details',
args=[order_with_lines_and_stock.pk])
# success messages should appear after redirect
diff --git a/tests/test_checkout.py b/tests/test_checkout.py
index 7ac36d0bac..2a4fd4649c 100644
--- a/tests/test_checkout.py
+++ b/tests/test_checkout.py
@@ -218,7 +218,7 @@ def test_checkout_billing_address(user, address):
302, reverse('cart:index'))])
def test_index_view(cart, status_code, url, rf, monkeypatch):
checkout = Checkout(cart, AnonymousUser(), 'tracking_code')
- request = rf.get('checkout:index')
+ request = rf.get('checkout:index', follow=True)
request.user = checkout.user
request.session = {STORAGE_SESSION_KEY: checkout.for_storage()}
request.discounts = []
diff --git a/tests/utils.py b/tests/utils.py
index f79b74b5f5..7461ea05e3 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -1,18 +1,14 @@
import json
-from urllib.parse import urlparse
+from django.conf import settings
from django.db.models import Q
+from django.urls import translate_url
from django.utils.encoding import smart_text
-def get_url_path(url):
- parsed_url = urlparse(url)
- return parsed_url.path
-
-
def get_redirect_location(response):
- # Due to Django 1.8 compatibility, we have to handle both cases
- return get_url_path(response['Location'])
+ path = response['Location']
+ return translate_url(path, lang_code=settings.LANGUAGE_CODE)
def filter_products_by_attribute(queryset, attribute_id, value):