[Django 1.9] Remove testserver from expected_url

This patch removes the 'http://testserver' section from the test URLs

Ref:
https://docs.djangoproject.com/en/1.9/releases/1.9/#http-redirects-no-longer-forced-to-absolute-uris

Change-Id: Ic6e599f516c952640e011922a3270edbe4f50b5c
Partially-Implements: blueprint drop-dj17
This commit is contained in:
Rob Cresswell 2016-01-24 22:58:30 +00:00
parent 6879ea7cb9
commit 8b2a3417e3

View File

@ -24,6 +24,7 @@ import unittest
from ceilometerclient.v2 import client as ceilometer_client
from cinderclient import client as cinder_client
import django
from django.conf import settings
from django.contrib.messages.storage import default_storage # noqa
from django.core.handlers import wsgi
@ -229,8 +230,12 @@ class TestCase(horizon_helpers.TestCase):
Asserts that the given response issued a 302 redirect without
processing the view which is redirected to.
"""
self.assertEqual(response._headers.get('location', None),
('Location', settings.TESTSERVER + expected_url))
if django.VERSION >= (1, 9):
self.assertEqual(response._headers.get('location', None),
('Location', expected_url))
else:
self.assertEqual(response._headers.get('location', None),
('Location', settings.TESTSERVER + expected_url))
self.assertEqual(response.status_code, 302)
def assertNoFormErrors(self, response, context_name="form"):