Пример #1
0
    def test_comment_get_by_issue_GET(self):
        second_issue = create_issue(self.project, self.milestone)
        first_comment = create_comment(self.issue, self.user,
                                       '1st comment 1st issue')
        second_comment = create_comment(self.issue, self.user,
                                        '2nd comment 1st issue')
        third_comment = create_comment(second_issue, self.user,
                                       '1st comment 2nd issue')

        response = self.client.get(self.comment_by_issue_url)
        all_comments = response.context_data['comment_list']

        self.assertEqual(all_comments.count(), 2)
Пример #2
0
    def test_adding_new_comment(self):
        first_comment = create_comment(self.issue, self.user, 'First comment')

        comments_before_add = Comment.objects.all()
        comments_before_len = comments_before_add.count()

        new_comment = create_comment(self.issue, self.user, 'New comment')

        comments_after_add = Comment.objects.order_by('-time')
        last_added_com = comments_after_add[0]
        comments_after_len = comments_after_add.count()

        self.assertEqual(comments_before_len + 1, comments_after_len)
        self.assertEqual(new_comment.description, last_added_com.description)
Пример #3
0
    def test_create_comment_POST(self):
        first_comment = create_comment(self.issue, self.user,
                                       '1st comment 1st issue')

        new_comment = {
            'author_id': 1,
            'description': 'New comment',
            'issues_id': 1
        }

        response_after_create = self.client.post(self.new_comment_url,
                                                 new_comment)

        self.assertEqual(response_after_create.status_code, 200)
Пример #4
0
    def test_issue_log_GET(self):
        comment = create_comment(self.issue, self.user, 'New comment')
        create_comment_event(comment.pk)

        response = self.client.get(self.issue_log_url)
        response_context = response.context_data
        comment_events_objects = response_context['log_comment_events']
        issue_events_objects = response_context['log_issue_events']

        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'uxhub/issue_log.html')

        self.assertTrue('log_issue_events' in response_context)
        self.assertTrue('log_comment_events' in response_context)
        self.assertEqual(comment_events_objects.count(), 1)
        self.assertEqual(issue_events_objects.count(), 1)