diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-09-14 05:28:00 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-09-14 05:28:00 +0000 |
| commit | e70d7e60640e280f8d410d41c1f9cb6195483c4e (patch) | |
| tree | 601a16030a28d5709f3dfbfe87db8a82f596e03f /tests/modeltests | |
| parent | dc785104b8ffb33c57f5e17209743516c1bd88ae (diff) | |
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
Diffstat (limited to 'tests/modeltests')
| -rw-r--r-- | tests/modeltests/test_client/models.py | 12 |
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/') |
