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
1606876052-practice
Commits
95744644
Commit
95744644
authored
Sep 18, 2019
by
Rayza Arasj Mahardhika
Browse files
fix wrong test in unit test
parent
ff2246dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
lists/tests.py
View file @
95744644
from
django.urls
import
resolve
from
django.urls
import
resolve
,
reverse
from
django.test
import
TestCase
from
django.http
import
HttpRequest
...
...
@@ -19,16 +19,18 @@ class HomePageTest(TestCase):
self
.
assertIn
(
'<h1>Welcome to Rayza
\'
s Homepage</h1>'
,
html
)
self
.
assertTrue
(
html
.
endswith
(
'</html>'
))
class
AboutPageTest
(
TestCase
):
def
test_about_url_resolves_to_about_page_view
(
self
):
found
=
resolve
(
'
/
about'
)
found
=
resolve
(
reverse
(
'about'
)
)
self
.
assertEqual
(
found
.
func
,
about_page
)
def
test_about_page_returns_correct_html
(
self
):
request
=
HttpRequest
()
response
=
home
_page
(
request
)
response
=
about
_page
(
request
)
html
=
response
.
content
.
decode
(
'utf8'
)
self
.
assertTrue
(
html
.
startswith
(
'<html>'
))
self
.
assertIn
(
'<title>Rayza
\'
s About Page</title>'
,
html
)
self
.
assertIn
(
'<h1>Hello my name is Rayza Arasj Mahardhika</h1>'
,
html
)
self
.
asserIn
(
'<p>I
\'
m 21 years old</p>'
)
self
.
assertIn
(
'<h1>Hello
,
my name is Rayza Arasj Mahardhika</h1>'
,
html
)
self
.
asser
t
In
(
'<p>I
\'
m 21 years old</p>'
,
html
)
self
.
assertTrue
(
html
.
endswith
(
'</html>'
))
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