def test_delete_anothers_comment_on_own_file(self):
"""
A user can delete another's comment on their own 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('admin', '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)
评论列表
文章目录