Ticket #16456: comments-preview-request-object.diff

File comments-preview-request-object.diff, 1.5 KB (added by Tomáš Ehrlich, 13 years ago)

Tests added

  • django/contrib/comments/views/comments.py

     
    9797                "comment" : form.data.get("comment", ""),
    9898                "form" : form,
    9999                "next": next,
     100                "object" : target,
    100101            },
    101102            RequestContext(request, {})
    102103        )
  • tests/regressiontests/comment_tests/tests/comment_view_tests.py

     
    6868        response = self.client.post("/post/", data)
    6969        self.assertEqual(response.status_code, 200)
    7070        self.assertTemplateUsed(response, "comments/preview.html")
     71        self.assertEqual(response.context["object"], a)
    7172
     73    def testCommentErrorContext(self):
     74        a = Article.objects.get(pk=1)
     75        data = self.getValidData(a)
     76        del data["comment"]
     77        response = self.client.post("/post/", data)
     78        self.assertEqual(response.status_code, 200)
     79        self.assertTemplateUsed(response, "comments/preview.html")
     80        self.assertEqual(response.context["object"], a)
     81
    7282    def testHashTampering(self):
    7383        a = Article.objects.get(pk=1)
    7484        data = self.getValidData(a)
Back to Top