summaryrefslogtreecommitdiff
path: root/django/test
diff options
context:
space:
mode:
authorTobias McNulty <tobias@caktusgroup.com>2016-06-03 00:47:30 -0400
committerMarkus Holtermann <info@markusholtermann.eu>2016-06-02 21:47:30 -0700
commit78a0ca67f6dfb6c74dcabe36aa460c4eb5cfe7ae (patch)
treec90bda607e2494ea478cf6d7c2cfde65ae5ea8c1 /django/test
parentff9198ee0f1de24a5b2861d28849344e7a5714c4 (diff)
Refs #26666 -- Fixed test failures caused by assertRedirects changes (#6701)
Diffstat (limited to 'django/test')
-rw-r--r--django/test/testcases.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 79bf15a3fe..ba7a9ccd6c 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -303,7 +303,10 @@ class SimpleTestCase(unittest.TestCase):
path = urljoin(response.request['PATH_INFO'], path)
if fetch_redirect_response:
- if netloc:
+ # netloc might be empty, or in cases where Django tests the
+ # HTTP scheme, the convention is for netloc to be 'testserver'.
+ # Trust both as "internal" URLs here.
+ if netloc and netloc != 'testserver':
raise ValueError(
"The Django test client is unable to fetch remote URLs (got %s). "
"Use assertRedirects(..., fetch_redirect_response=False) instead." % url