

def testPreventDuplicateComments(self):
    'Prevent posting the exact same comment twice'
    a = Article.objects.get(pk=1)
    data = self.getValidData(a)
    self.client.post('/post/', data)
    self.client.post('/post/', data)
    self.assertEqual(Comment.objects.count(), 1)
    self.client.post('/post/', dict(data, comment='My second comment.'))
    self.assertEqual(Comment.objects.count(), 2)

dataset/ETHPy150Open dcramer/django-compositepks/tests/regressiontests/comment_tests/tests/comment_view_tests.py CommentViewTests.testPreventDuplicateComments/original