Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Lab01
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
Dan Mark Restoles
Lab01
Commits
37b82c42
Commit
37b82c42
authored
Mar 06, 2020
by
Dan Mark Restoles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated lab functional tests
parent
c4ba495a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
25 deletions
+14
-25
views.py
heroes/views.py
+4
-5
lab1_functional_test.py
lab1_functional_test.py
+10
-20
No files found.
heroes/views.py
View file @
37b82c42
from
django.shortcuts
import
render
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic
import
TemplateView
class
HeroesView
(
List
View
):
pass
class
HeroesView
(
Template
View
):
template_name
=
'list_heroes.html'
class
HeroView
(
Detail
View
):
class
HeroView
(
Template
View
):
template_name
=
"detail"
\ No newline at end of file
lab1_functional_test.py
View file @
37b82c42
...
...
@@ -21,31 +21,21 @@ class NewVisitorTest(unittest.TestCase):
# She sees a list containing three heroes with their corresponding
# names, health points, and damage
heroesURL
=
self
.
browser
.
get
(
'http://localhost:8000/heroes'
)
self
.
assertIn
(
'<dl>'
,
heroesURL
)
self
.
assertIn
(
'<dt></dt><dd></dd>'
,
heroesURL
)
self
.
assertIn
(
'<dt></dt><dd></dd>'
,
heroesURL
)
self
.
assertIn
(
'<dt></dt><dd></dd>'
,
heroesURL
)
self
.
assertIn
(
'</dl>'
,
heroesURL
)
self
.
assertIn
(
'<dl>'
,
heroesURL
)
self
.
assertIn
(
'<dt></dt><dd></dd>'
,
heroesURL
)
self
.
assertIn
(
'<dt></dt><dd></dd>'
,
heroesURL
)
self
.
assertIn
(
'<dt></dt><dd></dd>'
,
heroesURL
)
self
.
assertIn
(
'</dl>'
,
heroesURL
)
self
.
assertIn
(
'<dl>'
,
heroesURL
)
self
.
assertIn
(
'<dt></dt><dd></dd>'
,
heroesURL
)
self
.
assertIn
(
'<dt></dt><dd></dd>'
,
heroesURL
)
self
.
assertIn
(
'<dt></dt><dd></dd>'
,
heroesURL
)
self
.
assertIn
(
'</dl>'
,
heroesURL
)
response
=
self
.
browser
.
get
(
'http://localhost:8000/heroes'
)
self
.
assertEqual
(
response
.
resolver_match
.
func
.
__name__
,
HeroesView
.
as_view
()
.
__name__
)
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
response
=
self
.
browser
.
get
(
'http://localhost:8000/heroes/cloud'
)
self
.
assertEqual
(
response
.
resolver_match
.
func
.
__name__
,
HeroView
.
as_view
()
.
__name__
)
# She spots the page title and header mentions the name of the hero she selected.
self
.
assertEqual
(
self
.
browser
.
title
,
'Detail - Cloud'
)
# While she is in a specific hero's page, she sees a button labeled "Back to Heroes List".
# She clicks this and she is redirected back to the wiki's homepage.
response
=
self
.
browser
.
get
(
'http://localhost:8000/heroes'
)
self
.
assertEqual
(
response
.
resolver_match
.
func
.
__name__
,
HeroesView
.
as_view
()
.
__name__
)
self
.
fail
(
'Finish the test!'
)
...
...
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