Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Lab1-Willowisp
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
Patrick James Ong
Lab1-Willowisp
Commits
c6c87b6b
Commit
c6c87b6b
authored
Mar 07, 2020
by
Patrick James Ong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished storyline part 1
parent
ba859e54
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
18 deletions
+48
-18
home.html
willowisp/heroes/templates/home.html
+29
-0
views.py
willowisp/heroes/views.py
+1
-1
lab1_functional_test.py
willowisp/lab1_functional_test.py
+18
-17
No files found.
willowisp/heroes/templates/home.html
0 → 100644
View file @
c6c87b6b
<html>
<head>
<title>
The Will of the Wisps Wiki
</title>
<h1>
The Will of the Wisps Wiki
</head>
<body>
<h3
id=
"Cloud"
>
Cloud
</h3>
<ul>
<li>
Health Points: 600
</li>
<li>
Base Attack Damage: 57
</li>
<br>
</ul>
<h3
id=
"Jester"
>
Jester
</h3>
<ul>
<li>
Health Points: 660
</li>
<li>
Base Attack Damage: 64
</li>
<br>
</ul>
<h3
id=
"Sunflowey"
>
Sunflowey
</h3>
<ul>
<li>
Health Points: 650
</li>
<li>
Base Attack Damage: 43
</li>
</ul>
</body>
</html>
\ No newline at end of file
willowisp/heroes/views.py
View file @
c6c87b6b
...
@@ -5,7 +5,7 @@ from django.views.generic.list import ListView
...
@@ -5,7 +5,7 @@ from django.views.generic.list import ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
# Create your views here.
# Create your views here.
class
HomeListView
(
List
View
):
class
HomeListView
(
Template
View
):
template_name
=
'home.html'
template_name
=
'home.html'
...
...
willowisp/lab1_functional_test.py
View file @
c6c87b6b
...
@@ -20,34 +20,35 @@ class NewVisitorTest(unittest.TestCase):
...
@@ -20,34 +20,35 @@ class NewVisitorTest(unittest.TestCase):
# She sees a list containing three heroes with their corresponding
# She sees a list containing three heroes with their corresponding
# names, health points, and damage
# names, health points, and damage
self
.
assertIn
(
'Cloud'
,
self
.
browser
.
body
)
list_of_li
=
[
li
.
text
for
li
in
self
.
browser
.
find_elements_by_tag_name
(
'li'
)]
self
.
assertIn
(
'Health Points: 600'
,
self
.
browser
.
body
)
self
.
assertIn
(
'Cloud'
,
self
.
browser
.
find_element_by_id
(
'Cloud'
)
.
text
)
self
.
assertIn
(
'Base Attack Damage: 57'
,
self
.
browser
.
body
)
self
.
assertIn
(
'Health Points: 600'
,
list_of_li
[
0
])
self
.
assertIn
(
'Base Attack Damage: 57'
,
list_of_li
[
1
])
self
.
assertIn
(
'Jester'
,
self
.
browser
.
body
)
self
.
assertIn
(
'Jester'
,
self
.
browser
.
find_element_by_id
(
'Jester'
)
.
text
)
self
.
assertIn
(
'Health Points: 660'
,
self
.
browser
.
body
)
self
.
assertIn
(
'Health Points: 660'
,
list_of_li
[
2
]
)
self
.
assertIn
(
'Base Attack Damage: 64'
,
self
.
browser
.
body
)
self
.
assertIn
(
'Base Attack Damage: 64'
,
list_of_li
[
3
]
)
self
.
assertIn
(
'Sunflowey'
,
self
.
browser
.
body
)
self
.
assertIn
(
'Sunflowey'
,
self
.
browser
.
find_element_by_id
(
'Sunflowey'
)
.
text
)
self
.
assertIn
(
'Health Points: 650'
,
self
.
browser
.
body
)
self
.
assertIn
(
'Health Points: 650'
,
list_of_li
[
4
]
)
self
.
assertIn
(
'Base Attack Damage: 43'
,
self
.
browser
.
body
)
self
.
assertIn
(
'Base Attack Damage: 43'
,
list_of_li
[
5
]
)
# When she selects one of the heroes, she is sent to another page
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
# containing more information about the hero (additional stats, lore, image).
browser
.
get
(
'http://localhost:8000/hero/cloud'
)
#self.
browser.get('http://localhost:8000/hero/cloud')
browser
.
get
(
'http://localhost:8000/hero/sunflowey'
)
#self.
browser.get('http://localhost:8000/hero/sunflowey')
browser
.
get
(
'http://localhost:8000/hero/jester'
)
#self.
browser.get('http://localhost:8000/hero/jester')
# She spots the page title and header mentions the name of the hero she selected.
# She spots the page title and header mentions the name of the hero she selected.
self
.
assertIn
(
'Cloud'
,
self
.
browser
.
title
)
#
self.assertIn('Cloud', self.browser.title)
self
.
assertIn
(
'Sunflowey'
,
self
.
browser
.
title
)
#
self.assertIn('Sunflowey', self.browser.title)
self
.
assertIn
(
'Jester'
,
self
.
browser
.
title
)
#
self.assertIn('Jester', self.browser.title)
# While she is in a specific hero's page, she sees a button labeled "Back to Heroes List".
# 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.
# She clicks this and she is redirected back to the wiki's homepage.
self
.
browser
.
get
(
'http://localhost:8000'
)
#
self.browser.get('http://localhost:8000')
self
.
fail
(
'Finish the test!'
)
#
self.fail('Finish the test!')
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
(
warnings
=
'ignore'
)
unittest
.
main
(
warnings
=
'ignore'
)
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