summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2012-03-02 16:55:56 +0000
committerJannis Leidel <jannis@leidel.info>2012-03-02 16:55:56 +0000
commit4887a8de170ad9227d79f39f5bd3d2564f4e7ef8 (patch)
treecb70d0b3fe4ce9fef5bf805ca140500f693e8246 /tests
parent7b624c6c3205094b4fbf2ef2b7164ff7668665a5 (diff)
Fixed #16842 -- Modified the RedirectView to correctly handle query strings with percent symbols. Thanks, accuser, jamey@minilop.net and Claude Paroz.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17625 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/generic_views/base.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/regressiontests/generic_views/base.py b/tests/regressiontests/generic_views/base.py
index e7aeaf9cde..6528dc6723 100644
--- a/tests/regressiontests/generic_views/base.py
+++ b/tests/regressiontests/generic_views/base.py
@@ -283,6 +283,13 @@ class RedirectViewTest(unittest.TestCase):
self.assertEqual(response.status_code, 301)
self.assertEqual(response['Location'], '/bar/?pork=spam')
+ def test_include_urlencoded_args(self):
+ "GET arguments can be URL-encoded when included in the redirected URL"
+ response = RedirectView.as_view(url='/bar/', query_string=True)(
+ self.rf.get('/foo/?unicode=%E2%9C%93'))
+ self.assertEqual(response.status_code, 301)
+ self.assertEqual(response['Location'], '/bar/?unicode=%E2%9C%93')
+
def test_parameter_substitution(self):
"Redirection URLs can be parameterized"
response = RedirectView.as_view(url='/bar/%(object_id)d/')(self.rf.get('/foo/42/'), object_id=42)