def test_suspended_user_can_comment_own_question(self): question = self.post_question() self.user.set_status('s') comment = self.user.post_comment( parent_post = question, body_text = 'test comment' ) self.assertTrue(isinstance(comment, models.Comment)) self.assertTrue( template_filters.can_post_comment( self.user, question ) )
def test_suspended_user_cannot_comment_others_question(self): question = self.post_question(author = self.other_user) self.user.set_status('s') self.assertRaises( exceptions.PermissionDenied, self.user.post_comment, parent_post = question, body_text = 'test comment' ) self.assertFalse( template_filters.can_post_comment( self.user, question ) )