diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-03-03 13:04:51 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-03-03 13:04:51 +0000 |
| commit | 1985ca77eabf78d0c7a624825cde8fb4fa7752d1 (patch) | |
| tree | 2a4a4c2eed5c0f02626cc6e5866b8eb25d7d7c99 /tests/regressiontests | |
| parent | ac87e4f8fa5f7242a5dc274436891a50a8a60904 (diff) | |
[1.2.X] Fixed #13411 -- Made sure URL fragments are correctly handled by the next_redirect utility of the comments apps. Thanks, timesong, dpn and Julien Phalip.
Backport from trunk (r15720).
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15721 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/comment_tests/tests/comment_view_tests.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/regressiontests/comment_tests/tests/comment_view_tests.py b/tests/regressiontests/comment_tests/tests/comment_view_tests.py index b8a62b4246..5e791966ae 100644 --- a/tests/regressiontests/comment_tests/tests/comment_view_tests.py +++ b/tests/regressiontests/comment_tests/tests/comment_view_tests.py @@ -256,3 +256,27 @@ class CommentViewTests(CommentTestCase): broken_location = location + u"\ufffd" response = self.client.get(broken_location) self.assertEqual(response.status_code, 200) + + def testCommentNextWithQueryStringAndAnchor(self): + """ + The `next` key needs to handle already having an anchor. Refs #13411. + """ + # With a query string also. + a = Article.objects.get(pk=1) + data = self.getValidData(a) + data["next"] = "/somewhere/else/?foo=bar#baz" + data["comment"] = "This is another comment" + response = self.client.post("/post/", data) + location = response["Location"] + match = re.search(r"^http://testserver/somewhere/else/\?foo=bar&c=\d+#baz$", location) + self.failUnless(match != None, "Unexpected redirect location: %s" % location) + + # Without a query string + a = Article.objects.get(pk=1) + data = self.getValidData(a) + data["next"] = "/somewhere/else/#baz" + data["comment"] = "This is another comment" + response = self.client.post("/post/", data) + location = response["Location"] + match = re.search(r"^http://testserver/somewhere/else/\?c=\d+#baz$", location) + self.failUnless(match != None, "Unexpected redirect location: %s" % location) |
