Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
DIGIPUS
Commits
1e49ee1b
Commit
1e49ee1b
authored
Oct 30, 2020
by
Azhar Rais
Browse files
[REFACTOR] Make pagination_html a function instead of lambda
parent
ad6b3e41
Pipeline
#59983
passed with stages
in 12 minutes and 43 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
forum/tests.py
View file @
1e49ee1b
...
...
@@ -165,6 +165,10 @@ class DiscussionCommentModelTest(TestCase):
self
.
assertEqual
(
discussion_comment
.
materi
.
count
(),
2
)
def
pagination_html
(
page
):
return
'<li class="page-item"><a class="page-link" href="?page={}">{}</a></li>'
.
format
(
page
,
page
)
class
ForumHomePageTest
(
TestCase
):
def
setUp
(
self
):
self
.
USER_CONTRIBUTOR
=
User
.
objects
.
create_contributor
(
email
=
CONTRIBUTOR_EMAIL
,
password
=
CONTRIBUTOR_PASSWORD
)
...
...
@@ -203,8 +207,6 @@ class ForumHomePageTest(TestCase):
self
.
assertIn
(
"User Test"
,
request
.
content
.
decode
())
def
test_forum_home_pagination
(
self
):
pagination_html
=
lambda
page
:
'<li class="page-item"><a class="page-link" href="?page={}">{}</a></li>'
\
.
format
(
page
,
page
)
for
i
in
range
(
51
):
num
=
str
(
i
)
Discussion
.
objects
.
create
(
title
=
"Discussion "
+
num
,
description
=
"Description "
+
num
,
...
...
@@ -285,9 +287,6 @@ 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
(
101
):
data
.
append
(
DiscussionComment
(
description
=
"Description "
+
str
(
i
),
user
=
self
.
USER_CONTRIBUTOR
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment