Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Lab_1
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
Ayn Collado
Lab_1
Commits
02b1219a
Commit
02b1219a
authored
Mar 07, 2020
by
Ayn Collado
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
something something i give up
parent
32059956
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
101 additions
and
26 deletions
+101
-26
urls.cpython-38.pyc
heroes/__pycache__/urls.cpython-38.pyc
+0
-0
home_page.html
heroes/templates/home_page.html
+0
-11
tests.py
heroes/tests.py
+62
-3
urls.py
heroes/urls.py
+5
-5
cloud.png
templates/cloud.png
+0
-0
detail_cloud.html
templates/detail_cloud.html
+3
-2
detail_jester.html
templates/detail_jester.html
+3
-2
detail_sunflowey.html
templates/detail_sunflowey.html
+3
-2
home_page.html
templates/home_page.html
+23
-0
jester.png
templates/jester.png
+0
-0
sunflowey.png
templates/sunflowey.png
+0
-0
settings.cpython-38.pyc
willowisp/__pycache__/settings.cpython-38.pyc
+0
-0
settings.py
willowisp/settings.py
+2
-1
No files found.
heroes/__pycache__/urls.cpython-38.pyc
View file @
02b1219a
No preview for this file type
heroes/templates/home_page.html
deleted
100644 → 0
View file @
32059956
<html>
<head>
<title>
The Will of the Wisps Wiki
</title>
</head>
<body>
<div
align=
"center"
>
<a
href=
"
</div>
</body>
</html>
\ No newline at end of file
heroes/tests.py
View file @
02b1219a
from
selenium
import
webdriver
from
django.urls
import
resolve
from
django.urls
import
resolve
from
django.test
import
TestCase
import
unittest
from
.views
import
home_page
class
NewVisitorTest
(
unittest
.
TestCase
):
# Create your tests here.
def
setUp
(
self
):
self
.
browser
=
webdriver
.
Firefox
()
def
tearDown
(
self
):
self
.
browser
.
quit
()
def
test_can_display_a_heroes_list_and_more_information_per_hero
(
self
):
# Widget has heard about a new wiki app for the game called The Will of the Wisps.
# She goes to check out its homepage
self
.
browser
.
get
(
'http://localhost:8000'
)
# She notices the page title and header mention
# 'The Will of the Wisps Wiki'
self
.
assertIn
(
'The Will of the Wisps Wiki'
,
self
.
browser
.
title
)
# She sees a list containing three heroes with their corresponding
# names, health points, and damage
detail
=
self
.
browser
.
find_element_by_id
(
'cloud_name'
)
self
.
assertEqual
(
detail
.
get_attribute
(
'innerHTML'
),
'Cloud'
)
detail
=
self
.
browser
.
find_element_by_id
(
'cloud_hp'
)
self
.
assertEqual
(
detail
.
get_attribute
(
'innerHTML'
),
'600'
)
detail
=
self
.
browser
.
find_element_by_id
(
'cloud_ad'
)
self
.
assertEqual
(
detail
.
get_attribute
(
'innerHTML'
),
'57'
)
detail
=
self
.
browser
.
find_element_by_id
(
'sunflowey_name'
)
self
.
assertEqual
(
detail
.
get_attribute
(
'innerHTML'
),
'Sunflowey'
)
detail
=
self
.
browser
.
find_element_by_id
(
'sunflowey_hp'
)
self
.
assertEqual
(
detail
.
get_attribute
(
'innerHTML'
),
'650'
)
detail
=
self
.
browser
.
find_element_by_id
(
'sunflowey_ad'
)
self
.
assertEqual
(
detail
.
get_attribute
(
'innerHTML'
),
'43'
)
detail
=
self
.
browser
.
find_element_by_id
(
'jester_name'
)
self
.
assertEqual
(
detail
.
get_attribute
(
'innerHTML'
),
'Jester'
)
detail
=
self
.
browser
.
find_element_by_id
(
'jester_hp'
)
self
.
assertEqual
(
detail
.
get_attribute
(
'innerHTML'
),
'660'
)
detail
=
self
.
browser
.
find_element_by_id
(
'jester_ad'
)
self
.
assertEqual
(
detail
.
get_attribute
(
'innerHTML'
),
'64'
)
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
self
.
browser
.
get
(
'http://localhost:8000/hero/cloud'
)
self
.
browser
.
get
(
'http://localhost:8000/hero/sunflowey'
)
self
.
browser
.
get
(
'http://localhost:8000/hero/jester'
)
# She spots the page title and header mentions the name of the hero she selected.
detail
=
self
.
browser
.
find_element_by_id
(
'cloud_title'
)
self
.
assertEqual
(
detail
.
get_attribute
(
'innerHTML'
),
'Detail - Cloud'
)
detail
=
self
.
browser
.
find_element_by_id
(
'cloud_heading'
)
self
.
assertEqual
(
detail
.
get_attribute
(
'innerHTML'
),
'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.
button
=
self
.
browser
.
find_element_by_id
(
'back_button'
)
self
.
assertEqual
(
button
.
get_attribute
(
'innerHTML'
),
'Back to Heroes List'
)
self
.
fail
(
'Finish the test!'
)
if
__name__
==
'__main__'
:
unittest
.
main
(
warnings
=
'ignore'
)
\ No newline at end of file
heroes/urls.py
View file @
02b1219a
...
@@ -2,9 +2,9 @@ from django.urls import path
...
@@ -2,9 +2,9 @@ from django.urls import path
from
.views
import
home_page
,
cloud
,
sunflowey
,
jester
from
.views
import
home_page
,
cloud
,
sunflowey
,
jester
urlpatterns
=
[
urlpatterns
=
[
path
(
r'
^$
'
,
home_page
,
name
=
'home_page'
),
path
(
r''
,
home_page
,
name
=
'home_page'
),
path
(
r'heroes/
$
'
,
home_page
,
name
=
'home_page'
),
path
(
r'heroes/'
,
home_page
,
name
=
'home_page'
),
path
(
r'hero/cloud
$
'
,
cloud
,
name
=
'cloud'
),
path
(
r'hero/cloud'
,
cloud
,
name
=
'cloud'
),
path
(
r'hero/sunflowey
$
'
,
sunflowey
,
name
=
'sunflowey'
),
path
(
r'hero/sunflowey'
,
sunflowey
,
name
=
'sunflowey'
),
path
(
r'hero/jester
$
'
,
jester
,
name
=
'jester'
),
path
(
r'hero/jester'
,
jester
,
name
=
'jester'
),
]
]
heroes/
templates/cloud.png
→
templates/cloud.png
View file @
02b1219a
File moved
heroes/
templates/detail_cloud.html
→
templates/detail_cloud.html
View file @
02b1219a
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<head>
<head>
<title>
Detail - Cloud
</title>
<title
id=
'cloud_title'
>
Detail - Cloud
</title>
</head>
</head>
<body>
<body>
<img
src=
"./cloud.png"
style=
"width: 10vw;"
/>
<img
src=
"./cloud.png"
style=
"width: 10vw;"
/>
<h1>
Detail - Cloud
</h1>
<h1
id=
"cloud_heading"
>
Detail - Cloud
</h1>
<dl>
<dl>
<dt>
Health Points
</dt><dd>
600
</dd>
<dt>
Health Points
</dt><dd>
600
</dd>
<dt>
Base Attack Damage
</dt><dd>
57
</dd>
<dt>
Base Attack Damage
</dt><dd>
57
</dd>
<dt>
Skills
</dt><dd>
Nimbus, Rain Cloud, Thunderbolt
</dd>
<dt>
Skills
</dt><dd>
Nimbus, Rain Cloud, Thunderbolt
</dd>
<dt>
Lore
</dt><dd>
I am a cloud. When I pee you call it 'rain'.
</dd>
<dt>
Lore
</dt><dd>
I am a cloud. When I pee you call it 'rain'.
</dd>
</dl>
</dl>
<button><a
href=
"/heroes"
id=
'back_button'
>
Back to Heroes List
</a></button>
</body>
</body>
</html>
</html>
\ No newline at end of file
heroes/
templates/detail_jester.html
→
templates/detail_jester.html
View file @
02b1219a
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<head>
<head>
<title>
Detail - Jester
</title>
<title
id=
'jester_title'
>
Detail - Jester
</title>
</head>
</head>
<body>
<body>
<img
src=
"./jester.png"
style=
"width: 10vw;"
/>
<img
src=
"./jester.png"
style=
"width: 10vw;"
/>
<h1>
Detail - Jester
</h1>
<h1
id=
"jester_heading"
>
Detail - Jester
</h1>
<dl>
<dl>
<dt>
Health Points
</dt><dd>
660
</dd>
<dt>
Health Points
</dt><dd>
660
</dd>
<dt>
Base Attack Damage
</dt><dd>
64
</dd>
<dt>
Base Attack Damage
</dt><dd>
64
</dd>
<dt>
Skills
</dt><dd>
Laugh, Dance, Smile
</dd>
<dt>
Skills
</dt><dd>
Laugh, Dance, Smile
</dd>
<dt>
Lore
</dt><dd>
I do it for the LOLs.
</dd>
<dt>
Lore
</dt><dd>
I do it for the LOLs.
</dd>
</dl>
</dl>
<button><a
href=
"/heroes"
id=
'back_button'
>
Back to Heroes List
</a></button>
</body>
</body>
</html>
</html>
\ No newline at end of file
heroes/
templates/detail_sunflowey.html
→
templates/detail_sunflowey.html
View file @
02b1219a
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<head>
<head>
<title>
Detail - Sunflowey
</title>
<title
id=
'sunflowey_title'
>
Detail - Sunflowey
</title>
</head>
</head>
<body>
<body>
<img
src=
"./sunflowey.png"
style=
"width: 10vw;"
/>
<img
src=
"./sunflowey.png"
style=
"width: 10vw;"
/>
<h1>
Detail - Sunflowey
</h1>
<h1
id=
"sunflowey_heading"
>
Detail - Sunflowey
</h1>
<dl>
<dl>
<dt>
Health Points
</dt><dd>
650
</dd>
<dt>
Health Points
</dt><dd>
650
</dd>
<dt>
Base Attack Damage
</dt><dd>
43
</dd>
<dt>
Base Attack Damage
</dt><dd>
43
</dd>
<dt>
Skills
</dt><dd>
Power Pellet, Sunshine, Pollen Punch
</dd>
<dt>
Skills
</dt><dd>
Power Pellet, Sunshine, Pollen Punch
</dd>
<dt>
Lore
</dt><dd>
I am Sunflowey. Sometimes a sun, sometimes a flower.
</dd>
<dt>
Lore
</dt><dd>
I am Sunflowey. Sometimes a sun, sometimes a flower.
</dd>
</dl>
</dl>
<button><a
href=
"/heroes"
id=
'back_button'
>
Back to Heroes List
</a></button>
</body>
</body>
</html>
</html>
\ No newline at end of file
templates/home_page.html
0 → 100644
View file @
02b1219a
<html>
<head>
<title>
The Will of the Wisps Wiki
</title>
</head>
<body>
<hl><a
href=
"/hero/cloud"
id=
"cloud_name"
>
Cloud
</a></hl>
<dl>
<dt>
Health Points:
</dt>
<dd
id=
"cloud_hp"
>
600
</dd>
<dt>
Base Attack Damage:
</dt>
<dd
id=
"cloud_ad"
>
57
</dd>
</dl>
<hl><a
href=
"/hero/sunflowey"
id=
"sunflowey_name"
>
Sunflowey
</a></hl>
<dl>
<dt>
Health Points:
</dt>
<dd
id=
"sunflowey_hp"
>
650
</dd>
<dt>
Base Attack Damage:
</dt>
<dd
id=
"sunflowey_ad"
>
43
</dd>
</dl>
<hl><a
href=
"/hero/jester"
id=
"jester_name"
>
Jester
</a></hl>
<dl>
<dt>
Health Points:
</dt>
<dd
id=
"jester_hp"
>
660
</dd>
<dt>
Base Attack Damage:
</dt>
<dd
id=
"jester_ad"
>
64
</dd>
</dl>
</body>
</html>
\ No newline at end of file
heroes/
templates/jester.png
→
templates/jester.png
View file @
02b1219a
File moved
heroes/
templates/sunflowey.png
→
templates/sunflowey.png
View file @
02b1219a
File moved
willowisp/__pycache__/settings.cpython-38.pyc
View file @
02b1219a
No preview for this file type
willowisp/settings.py
View file @
02b1219a
...
@@ -37,6 +37,7 @@ INSTALLED_APPS = [
...
@@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions'
,
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'django.contrib.staticfiles'
,
'selenium'
,
'heroes'
,
'heroes'
,
]
]
...
@@ -55,7 +56,7 @@ ROOT_URLCONF = 'willowisp.urls'
...
@@ -55,7 +56,7 @@ ROOT_URLCONF = 'willowisp.urls'
TEMPLATES
=
[
TEMPLATES
=
[
{
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[
'templates'
],
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'templates'
),
os
.
path
.
join
(
BASE_DIR
,
'heroes'
,
'templates'
)
],
'APP_DIRS'
:
True
,
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'OPTIONS'
:
{
'context_processors'
:
[
'context_processors'
:
[
...
...
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