diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2007-09-03 11:21:40 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2007-09-03 11:21:40 +0000 |
| commit | 3bf4ef0c77f80e2ed7fab298679ab0c5f28bc900 (patch) | |
| tree | 89e50ada1d950d35b2862754dca2ec3c10099ca0 /django/test/testcases.py | |
| parent | afc6985267609d7782ec01817b051267fef48cd1 (diff) | |
Fixed #4988 -- In the test client, Added tracking of the client and request that caused a response so that the assertRedirects check can use the correct client when following a redirect. Well spotted, alex@gc-web.de.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6039 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/test/testcases.py')
| -rw-r--r-- | django/test/testcases.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py index 2ed2e9ba26..400d66cfab 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -80,7 +80,9 @@ class TestCase(unittest.TestCase): self.assertEqual(url, expected_url, "Response redirected to '%s', expected '%s'" % (url, expected_url)) - redirect_response = self.client.get(path, QueryDict(query)) + # Get the redirection page, using the same client that was used + # to obtain the original response. + redirect_response = response.client.get(path, QueryDict(query)) self.assertEqual(redirect_response.status_code, target_status_code, "Couldn't retrieve redirection page '%s': response code was %d (expected %d)" % (path, redirect_response.status_code, target_status_code)) |
