def test_can_delete_own_comment(self):
"""
A user should be able to delete their comment on another's sharedfile.
"""
admins_sharedfile = test.factories.sharedfile(self.admin)
comment = models.Comment(user_id=self.bob.id, sharedfile_id=admins_sharedfile.id, body="just a comment")
comment.save()
self.sign_in('bob', 'asdfasdf')
self.assertEqual(None, models.Comment.get("id = %s and deleted = 1", comment.id))
response = self.post_url("/p/%s/comment/%s/delete" % (admins_sharedfile.share_key, comment.id))
self.assertEqual(comment.id, models.Comment.get("id = %s and deleted = 1", comment.id).id)
评论列表
文章目录