Ticket #12151: 12151_tests.diff

File 12151_tests.diff, 1.1 KB (added by Thejaswi Puthraya, 15 years ago)

tests to reproduce the problem

  • tests/regressiontests/comment_tests/tests/comment_view_tests.py

    a b class CommentViewTests(CommentTestCase):  
    219219        location = response["Location"]       
    220220        match = re.search(r"^http://testserver/somewhere/else/\?foo=bar&c=\d+$", location)
    221221        self.failUnless(match != None, "Unexpected redirect location: %s" % location)
    222        
    223  No newline at end of file
     222
     223    def testCommentDoneReSubmitWithInvalidParams(self):
     224        """
     225        If the comment-done url is resubmitted with some invalid data
     226        ie mainly some non-integer, then a UnicodeEncodeError (a sub-class
     227        of ValueError).
     228        """
     229        a = Article.objects.get(pk=1)
     230        data = self.getValidData(a)
     231        data["comment"] = "This is another comment"
     232        response = self.client.post("/post/", data)
     233        location = response["Location"]
     234        new_location = location + u"\ufffd"
     235        x = lambda : self.client.get(new_location)
     236        self.assertRaises(ValueError, x)
Back to Top