Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
willowisp_valenzuela
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
Anton Ralph Valenzuela
willowisp_valenzuela
Commits
abe006a5
Commit
abe006a5
authored
Mar 06, 2020
by
Anton Ralph F. Valenzuela
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished heroes unit test.
parent
3a3d17bd
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
68 deletions
+34
-68
.gitignore
.gitignore
+2
-1
functional_tests.py
functional_tests.py
+10
-11
tests.py
heroes/tests.py
+1
-4
urls.py
heroes/urls.py
+3
-3
views.py
heroes/views.py
+9
-0
lab1_functional_test.py
lab1_functional_test.py
+0
-31
settings.py
willowisp/settings.py
+7
-2
urls.py
willowisp/urls.py
+2
-16
No files found.
.gitignore
View file @
abe006a5
test
env/
env/
__pycache__
*.pyc
geckodriver.exe
functional_tests.py
View file @
abe006a5
...
...
@@ -11,7 +11,7 @@ class NewVisitorTest(unittest.TestCase):
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'
)
self
.
browser
.
get
(
'http://localhost:8000
/heroes
'
)
# She notices the page title and header mention
# 'The Will of the Wisps Wiki'
...
...
@@ -19,7 +19,6 @@ class NewVisitorTest(unittest.TestCase):
# She sees a list containing three heroes with their corresponding
# names, health points, and damage
self
.
browser
.
get
(
'http:://localhost:8000/heroes'
)
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
...
...
heroes/tests.py
View file @
abe006a5
...
...
@@ -3,8 +3,5 @@ from django.test import TestCase
class
HomePageTest
(
TestCase
):
def
test_heroes_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/'
)
html
=
response
.
content
.
decode
(
'utf8'
)
response
=
self
.
client
.
get
(
'/heroes/'
)
self
.
assertTemplateUsed
(
response
,
'heroes.html'
)
heroes/urls.py
View file @
abe006a5
from
django.conf.urls
import
url
from
.views
import
heroes_page
from
.views
import
heroes_page
,
cloud_page
,
sunflowey_page
,
jester_page
urlpatterns
=
[
url
(
r'^heroes/$'
,
heroes_page
,
name
=
'heroes_page'
),
url
(
r'^hero/cloud$'
,
cloud_page
,
name
=
'cloud_page'
),
url
(
r'^hero/sunflowey$'
,
sunflowey_page
,
name
=
'
sunflowey
_page'
),
url
(
r'^hero/jester$'
,
jester_page
,
name
=
'
jester
_page'
),
url
(
r'^hero/sunflowey$'
,
sunflowey_page
,
name
=
'
cloud
_page'
),
url
(
r'^hero/jester$'
,
jester_page
,
name
=
'
cloud
_page'
),
]
heroes/views.py
View file @
abe006a5
...
...
@@ -2,3 +2,12 @@ from django.shortcuts import render
def
heroes_page
(
request
):
return
render
(
request
,
'heroes.html'
)
def
cloud_page
(
request
):
pass
def
sunflowey_page
(
request
):
pass
def
jester_page
(
request
):
pass
lab1_functional_test.py
deleted
100644 → 0
View file @
3a3d17bd
from
selenium
import
webdriver
import
unittest
class
NewVisitorTest
(
unittest
.
TestCase
):
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
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
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
# She spots the page title and header mentions the name of the hero she selected.
# 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.
self
.
fail
(
'Finish the test!'
)
\ No newline at end of file
willowisp/settings.py
View file @
abe006a5
...
...
@@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'heroes'
,
]
MIDDLEWARE
=
[
...
...
@@ -75,8 +76,12 @@ WSGI_APPLICATION = 'willowisp.wsgi.application'
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.sqlite3'
,
'NAME'
:
os
.
path
.
join
(
BASE_DIR
,
'db.sqlite3'
),
'ENGINE'
:
'django.db.backends.postgresql_psycopg2'
,
'NAME'
:
'willowisp'
,
'USER'
:
'postgres'
,
'PASSWORD'
:
'tabatsoy11'
,
'HOST'
:
'localhost'
,
'PORT'
:
'5432'
,
}
}
...
...
willowisp/urls.py
View file @
abe006a5
"""willowisp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from
django.conf.urls
import
url
from
django.conf.urls
import
include
,
url
from
django.contrib
import
admin
urlpatterns
=
[
url
(
r'^admin/'
,
admin
.
site
.
urls
),
url
(
r''
,
include
(
'heroes.urls'
)),
]
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