diff options
| author | Carl Meyer <carl@oddbird.net> | 2014-08-15 17:21:01 -0600 |
|---|---|---|
| committer | Carl Meyer <carl@oddbird.net> | 2014-08-15 17:21:01 -0600 |
| commit | 9fef66ef7c3dbb156d0b235261ec499f81494eae (patch) | |
| tree | db6f717220dde39efc49c6483025b2275aec3478 /tests | |
| parent | 90b64db39c4fd1243182068c3a54c3e08cd0f4b9 (diff) | |
| parent | 230393e5e81ff524a3ab8c476f75011d3ac53115 (diff) | |
Merge pull request #3072 from collinanderson/23295
Fixed #23295 -- Removed unnecessary fix_location_header request.get_host() check
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/http_utils/tests.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/http_utils/tests.py b/tests/http_utils/tests.py index 9105e64ee4..3225bfebf1 100644 --- a/tests/http_utils/tests.py +++ b/tests/http_utils/tests.py @@ -3,8 +3,8 @@ from __future__ import unicode_literals import io import gzip -from django.http import HttpRequest, HttpResponse, StreamingHttpResponse -from django.http.utils import conditional_content_removal +from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, StreamingHttpResponse +from django.http.utils import conditional_content_removal, fix_location_header from django.test import TestCase @@ -69,3 +69,14 @@ class HttpUtilTests(TestCase): res = StreamingHttpResponse(['abc']) conditional_content_removal(req, res) self.assertEqual(b''.join(res), b'') + + def test_fix_location_without_get_host(self): + """ + Tests that you can return an absolute redirect when the request + host is not in ALLOWED_HOSTS. Issue #20472 + """ + request = HttpRequest() + def bomb(): + self.assertTrue(False) + request.get_host = bomb + fix_location_header(request, HttpResponseRedirect('http://example.com')) |
