Skip to content

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

Fix redirection checks for Django 1.8

Patryk Zawadzkie41f7e82323d
diff --git a/saleor/cart/context_processors.py b/saleor/cart/context_processors.py
index fbc4d74e3f..e5b9805dc9 100644
--- a/saleor/cart/context_processors.py
+++ b/saleor/cart/context_processors.py
@@ -6,4 +6,3 @@ def cart_counter(request):
""" Return number of items from cart """
cart = get_cart_from_request(request)
return {'cart_counter': cart.quantity}
-
diff --git a/tests/test_product.py b/tests/test_product.py
index 21fd1e8eff..0b00c0a794 100644
--- a/tests/test_product.py
+++ b/tests/test_product.py
@@ -25,7 +25,10 @@ def test_product_page_redirects_to_correct_slug(client, product_in_stock):
uri = uri.replace(product_in_stock.get_slug(), 'spanish-inquisition')
response = client.get(uri)
assert response.status_code == 301
- assert response['location'] == product_in_stock.get_absolute_url()
+ location = response['location']
+ if location.startswith('http'):
+ location = location.split('http://testserver')[1]
+ assert location == product_in_stock.get_absolute_url()
def test_product_preview(admin_client, client, product_in_stock):