summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorKaren Tracey <kmtracey@gmail.com>2010-03-05 20:17:52 +0000
committerKaren Tracey <kmtracey@gmail.com>2010-03-05 20:17:52 +0000
commit80545c3685c29854990eaf17a96fc65d428f620f (patch)
treefcab0571edeaeb17581c1f2eade5e60d56060566 /tests/regressiontests
parenteb11229ba74d7918148f34851b6e0d2cfc16d681 (diff)
Fixed #12151: Ensured the comments code does not cause a server error when a request comes in for a comment specifying an invalid primary key value. Thanks thejaswi_puthraya.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12681 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
-rw-r--r--tests/regressiontests/comment_tests/tests/comment_view_tests.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/regressiontests/comment_tests/tests/comment_view_tests.py b/tests/regressiontests/comment_tests/tests/comment_view_tests.py
index 192131bf0c..f33a752843 100644
--- a/tests/regressiontests/comment_tests/tests/comment_view_tests.py
+++ b/tests/regressiontests/comment_tests/tests/comment_view_tests.py
@@ -219,4 +219,18 @@ class CommentViewTests(CommentTestCase):
location = response["Location"]
match = re.search(r"^http://testserver/somewhere/else/\?foo=bar&c=\d+$", location)
self.failUnless(match != None, "Unexpected redirect location: %s" % location)
- \ No newline at end of file
+
+ def testCommentDoneReSubmitWithInvalidParams(self):
+ """
+ Tests that attempting to retrieve the location specified in the
+ post redirect, after adding some invalid data to the expected
+ querystring it ends with, doesn't cause a server error.
+ """
+ a = Article.objects.get(pk=1)
+ data = self.getValidData(a)
+ data["comment"] = "This is another comment"
+ response = self.client.post("/post/", data)
+ location = response["Location"]
+ broken_location = location + u"\ufffd"
+ response = self.client.get(broken_location)
+ self.assertEqual(response.status_code, 200)