def test_comment_count(self):
"""
Comment count should return the number of comments belonging to
shard file. Should not count deleted comments.
"""
self.assertEqual(0, self.sharedfile.comment_count())
comment = Comment(sharedfile_id=self.sharedfile.id, user_id=self.user.id, body="just a comment")
comment.save()
self.assertEqual(1, self.sharedfile.comment_count())
comment = Comment(sharedfile_id=self.sharedfile.id, user_id=self.user.id, body="just a comment", deleted=True)
comment.save()
self.assertEqual(1, self.sharedfile.comment_count())
评论列表
文章目录