Refs #26666 -- Fixed test failures caused by assertRedirects changes (#6701)

This commit is contained in:
Tobias McNulty 2016-06-03 00:47:30 -04:00 committed by Markus Holtermann
parent ff9198ee0f
commit 78a0ca67f6
1 changed files with 4 additions and 1 deletions

View File

@ -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