summaryrefslogtreecommitdiff
path: root/tests/modeltests/test_client
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modeltests/test_client')
-rw-r--r--tests/modeltests/test_client/models.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/modeltests/test_client/models.py b/tests/modeltests/test_client/models.py
index 2bc1dfe02b..5e1eb529c0 100644
--- a/tests/modeltests/test_client/models.py
+++ b/tests/modeltests/test_client/models.py
@@ -83,9 +83,13 @@ class ClientTest(TestCase):
def test_redirect(self):
"GET a URL that redirects elsewhere"
response = self.client.get('/test_client/redirect_view/')
-
# Check that the response was a 302 (redirect)
self.assertRedirects(response, '/test_client/get_view/')
+
+ client_providing_host = Client(HTTP_HOST='django.testserver')
+ response = client_providing_host.get('/test_client/redirect_view/')
+ # Check that the response was a 302 (redirect) with absolute URI
+ self.assertRedirects(response, 'http://django.testserver/test_client/get_view/')
def test_redirect_with_query(self):
"GET a URL that redirects with given GET parameters"
@@ -97,10 +101,14 @@ class ClientTest(TestCase):
def test_permanent_redirect(self):
"GET a URL that redirects permanently elsewhere"
response = self.client.get('/test_client/permanent_redirect_view/')
-
# Check that the response was a 301 (permanent redirect)
self.assertRedirects(response, '/test_client/get_view/', status_code=301)
+ client_providing_host = Client(HTTP_HOST='django.testserver')
+ response = client_providing_host.get('/test_client/permanent_redirect_view/')
+ # Check that the response was a 301 (permanent redirect) with absolute URI
+ self.assertRedirects(response, 'http://django.testserver/test_client/get_view/', status_code=301)
+
def test_redirect_to_strange_location(self):
"GET a URL that redirects to a non-200 page"
response = self.client.get('/test_client/double_redirect_view/')