Пример #1
0
    def test_comment_created_on_post(self):
        request = self.rf.post('/', {'text': 'Hey'})
        request.user = self.user

        response = post_comment(request, str(self.ct.pk), str(self.ct.pk))

        tools.assert_equals(302, response.status_code)
        tools.assert_equals(1, RComment.objects.count())
Пример #2
0
    def test_template_rendered_on_get(self):
        request = self.rf.get('/')
        request.user = self.user

        response = post_comment(request, str(self.ct.pk), str(self.ct.pk))

        tools.assert_in('form', response.context_data)
        tools.assert_true(isinstance(response.context_data['form'], RCommentForm))