summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJuan Catalano <catalanojuan@gmail.com>2013-09-07 18:13:57 -0300
committerTim Graham <timograham@gmail.com>2013-09-10 12:22:55 -0400
commit4840fd9cbc3987781f7e6fab2520c9bd42aec057 (patch)
tree8ef89ecdca596e7f4ec81768eac30973004417fe /docs
parent79ccd1a101e6379c5a49da18fc006816e5ed127c (diff)
Fixed #20919 -- Extended assertRedirects to be able to avoid fetching redirect's response.
Thanks mjtamlyn for the suggestion.
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/1.7.txt5
-rw-r--r--docs/topics/testing/overview.txt8
2 files changed, 12 insertions, 1 deletions
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
index 9f05055fd2..3e247fd211 100644
--- a/docs/releases/1.7.txt
+++ b/docs/releases/1.7.txt
@@ -293,6 +293,11 @@ Tests
:attr:`~django.test.runner.DiscoverRunner.test_runner`, which facilitate
overriding the way tests are collected and run.
+* The ``fetch_redirect_response`` argument was added to
+ :meth:`~django.test.SimpleTestCase.assertRedirects`. Since the test
+ client can't fetch externals URLs, this allows you to use ``assertRedirects``
+ with redirects that aren't part of your Django app.
+
Backwards incompatible changes in 1.7
=====================================
diff --git a/docs/topics/testing/overview.txt b/docs/topics/testing/overview.txt
index 7c6f5caa47..420401cd4a 100644
--- a/docs/topics/testing/overview.txt
+++ b/docs/topics/testing/overview.txt
@@ -1542,7 +1542,7 @@ your test suite.
You can use this as a context manager in the same way as
:meth:`~SimpleTestCase.assertTemplateUsed`.
-.. method:: SimpleTestCase.assertRedirects(response, expected_url, status_code=302, target_status_code=200, msg_prefix='')
+.. method:: SimpleTestCase.assertRedirects(response, expected_url, status_code=302, target_status_code=200, msg_prefix='', fetch_redirect_response=True)
Asserts that the response return a ``status_code`` redirect status, it
redirected to ``expected_url`` (including any GET data), and the final
@@ -1552,6 +1552,12 @@ your test suite.
``target_status_code`` will be the url and status code for the final
point of the redirect chain.
+ .. versionadded:: 1.7
+
+ If ``fetch_redirect_response`` is ``False``, the final page won't be
+ loaded. Since the test client can't fetch externals URLs, this is
+ particularly useful if ``expected_url`` isn't part of your Django app.
+
.. method:: SimpleTestCase.assertHTMLEqual(html1, html2, msg=None)
Asserts that the strings ``html1`` and ``html2`` are equal. The comparison