Fakultas Ilmu Komputer UI

Commit a17f080c authored by Azhar Rais's avatar Azhar Rais
Browse files

[RED] Test discussion detail pagination

parent 9654ba36
Pipeline #59981 failed with stages
in 11 minutes and 37 seconds
......@@ -285,18 +285,24 @@ class ForumDiscussionDetailPageTest(TestCase):
def test_discussion_detail_page_pagination(self):
discussion_id = str(self.DISCUSSION.id)
pagination_html = lambda page: '<li class="page-item"><a class="page-link" href="?page={}">{}</a></li>' \
.format(page, page)
data = []
for i in range(25):
for i in range(101):
data.append(DiscussionComment(description="Description " + str(i), user=self.USER_CONTRIBUTOR,
discussion=self.DISCUSSION))
DiscussionComment.objects.bulk_create(data)
self.assertEqual(DiscussionComment.objects.count(), 25)
self.assertEqual(DiscussionComment.objects.count(), 101)
request = self.client.get(URL_DISCUSSION_DETAIL + discussion_id)
self.assertIn('Page 1 of 2', request.content.decode())
content = request.content.decode()
self.assertIn(pagination_html(1), content)
self.assertIn(pagination_html(2), content)
self.assertIn('<li class="page-item disabled"><a class="page-link" href="">...</a></li>', content)
self.assertIn(pagination_html(6), content)
self.assertIn('Description 1', request.content.decode())
def test_discussion_detail_show_correct_title(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment