From e70d7e60640e280f8d410d41c1f9cb6195483c4e Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Fri, 14 Sep 2007 05:28:00 +0000 Subject: Fixed #987 -- Convert relative URI portions into absolute URIs in HTTP Location headers. Based on a patch from SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6164 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/modeltests/test_client/models.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests/modeltests/test_client/models.py') 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/') -- cgit v1.3