summaryrefslogtreecommitdiff
path: root/tests/test_client
diff options
context:
space:
mode:
authorTobias McNulty <tobias@caktusgroup.com>2016-06-03 15:02:38 -0700
committerTim Graham <timograham@gmail.com>2016-06-20 11:07:46 -0400
commit17e661641ddaf8266e7430d83cfb2039abc55df7 (patch)
treefaab4310a86fed5682ff343efcffc9a9816a2eb3 /tests/test_client
parent00551c3eff5cedcb9cc7ce5af97b948d62713d97 (diff)
Refs #26666 -- Added ALLOWED_HOSTS validation when running tests.
Also used ALLOWED_HOSTS to check for external hosts in assertRedirects().
Diffstat (limited to 'tests/test_client')
-rw-r--r--tests/test_client/tests.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index 1c43a2957e..3db42cb1c2 100644
--- a/tests/test_client/tests.py
+++ b/tests/test_client/tests.py
@@ -601,7 +601,13 @@ class ClientTest(TestCase):
a relevant ValueError rather than a non-descript AssertionError.
"""
response = self.client.get('/django_project_redirect/')
- with self.assertRaisesMessage(ValueError, 'unable to fetch'):
+ msg = (
+ "The test client is unable to fetch remote URLs (got "
+ "https://www.djangoproject.com/). If the host is served by Django, "
+ "add 'www.djangoproject.com' to ALLOWED_HOSTS. "
+ "Otherwise, use assertRedirects(..., fetch_redirect_response=False)."
+ )
+ with self.assertRaisesMessage(ValueError, msg):
self.assertRedirects(response, 'https://www.djangoproject.com/')
def test_session_modifying_view(self):