image_comment_tests.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:mltshp 作者: MLTSHP 项目源码 文件源码
def test_a_non_logged_in_user_cant_delete_comments(self):
        """
        Posting to delete a comment if you're not logged in should result
        in a 403 error.  All comments remain intact.
        """
        sharedfile = test.factories.sharedfile(self.admin)
        comment = models.Comment(user_id=self.admin.id, sharedfile_id=sharedfile.id, body="just a comment")
        comment.save()
        response = self.post_url("/p/%s/comment/%s/delete" % (sharedfile.share_key, comment.id))
        self.assertEqual(response.code, 403)
        self.assertEqual(comment.id, models.Comment.get("id = %s and deleted = 0", comment.id).id)
        self.assertEqual(None, models.Comment.get("id = %s and deleted = 1", comment.id))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号