Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Collection of Practice
2019
1506722720-practice
Commits
15da4468
Commit
15da4468
authored
Sep 25, 2019
by
Dwi Nanda Susanto
Browse files
pass the custom comment test
parent
df46967f
Changes
1
Hide whitespace changes
Inline
Side-by-side
lists/tests.py
View file @
15da4468
...
...
@@ -15,7 +15,7 @@ class HomePageTest(TestCase):
response
=
self
.
client
.
get
(
'/'
)
html
=
response
.
content
.
decode
(
'utf8'
)
self
.
assertTrue
(
html
.
startswith
(
'<html>'
))
self
.
assertIn
(
'<title>To-Do
lists
</title>'
,
html
)
self
.
assertIn
(
'<title>To-Do</title>'
,
html
)
self
.
assertTrue
(
html
.
strip
().
endswith
(
'</html>'
))
self
.
assertTemplateUsed
(
response
,
'home.html'
)
...
...
@@ -48,6 +48,24 @@ class HomePageTest(TestCase):
self
.
assertIn
(
'itemey 1'
,
response
.
content
.
decode
())
self
.
assertIn
(
'itemey 2'
,
response
.
content
.
decode
())
def
test_comment_on_zero_items
(
self
):
response
=
self
.
client
.
get
(
'/'
)
self
.
assertIn
(
'yey, waktunya berlibur'
,
response
.
content
.
decode
())
def
test_comment_on_few_items
(
self
):
for
i
in
range
(
2
):
Item
.
objects
.
create
(
text
=
'itemey %d'
%
i
)
response
=
self
.
client
.
get
(
'/'
)
self
.
assertIn
(
'sibuk tapi santai'
,
response
.
content
.
decode
())
def
test_comment_on_many_items
(
self
):
for
i
in
range
(
6
):
Item
.
objects
.
create
(
text
=
'itemey %d'
%
i
)
response
=
self
.
client
.
get
(
'/'
)
self
.
assertIn
(
'oh tidak'
,
response
.
content
.
decode
())
class
ItemModelTest
(
TestCase
):
def
test_saving_and_retrieving_items
(
self
):
first_item
=
Item
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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