Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Lab1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kyla Nicole Villegas
Lab1
Commits
c123899d
Commit
c123899d
authored
Mar 07, 2020
by
Kyla Villegas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created and passed first unit testing
parent
15adec11
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
tests.py
heroes/tests.py
+9
-1
No files found.
heroes/tests.py
View file @
c123899d
from
django.urls
import
resolve
from
django.urls
import
resolve
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.http
import
HttpRequest
from
.views
import
home_page
from
.views
import
home_page
# Create your tests here.
class
HomePageTest
(
TestCase
):
class
HomePageTest
(
TestCase
):
def
test_root_url_resolves_to_home_page_view
(
self
):
def
test_root_url_resolves_to_home_page_view
(
self
):
found
=
resolve
(
'/'
)
found
=
resolve
(
'/'
)
self
.
assertEqual
(
found
.
func
,
home_page
)
self
.
assertEqual
(
found
.
func
,
home_page
)
def
test_home_page_returns_correct_html
(
self
):
request
=
HttpRequest
()
response
=
home_page
(
request
)
html
=
response
.
content
.
decode
(
'utf8'
)
self
.
assertTrue
(
html
.
startswith
(
'<html>'
))
self
.
assertIn
(
'<title>The Will of the Wisps Wiki</title>'', html)
self.assertTrue(html.endswith('
</
html
>
'))
Write
Preview
Markdown
is supported
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