Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS-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
King Arthur Santos
CS-Lab-1
Commits
f9979f17
Commit
f9979f17
authored
Mar 07, 2020
by
King Arthur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created unit tests for each character page.
parent
271ac4bf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
6 deletions
+34
-6
tests.py
heroes/tests.py
+13
-3
urls.py
heroes/urls.py
+9
-1
views.py
heroes/views.py
+9
-0
urls.cpython-37.pyc
willowisp/__pycache__/urls.cpython-37.pyc
+0
-0
urls.py
willowisp/urls.py
+3
-2
No files found.
heroes/tests.py
View file @
f9979f17
...
...
@@ -2,7 +2,17 @@ from django.test import TestCase
# Create your tests here.
class
HomePageTest
(
TestCase
):
def
test_home_page_displays_correctly
(
self
):
response
=
self
.
client
.
get
(
"/"
)
self
.
assertTemplateUsed
(
response
,
"home.html"
)
\ No newline at end of file
response
=
self
.
client
.
get
(
"/heroes"
)
self
.
assertTemplateUsed
(
response
,
"home.html"
)
class
CharacterPageTests
(
TestCase
):
def
test_cloud_page_displays_correctly
(
self
):
response
=
self
.
client
.
get
(
"/hero/cloud"
)
self
.
assertTemplateUsed
(
response
,
"detail_cloud.html"
)
def
test_sunflowey_page_displays_correctly
(
self
):
response
=
self
.
client
.
get
(
"/hero/sunflowey"
)
self
.
assertTemplateUsed
(
response
,
"detail_sunflowey.html"
)
def
test_jester_page_displays_correctly
(
self
):
response
=
self
.
client
.
get
(
"/hero/jester"
)
self
.
assertTemplateUsed
(
response
,
"detail_jester.html"
)
\ No newline at end of file
heroes/urls.py
View file @
f9979f17
from
django.conf.urls
import
url
from
.views
import
HomePageView
from
.views
import
DetailCloudView
from
.views
import
DetailSunfloweyView
from
.views
import
DetailJesterView
urlpatterns
=
[
url
(
r"^heroes$"
,
HomePageView
.
as_view
(),
name
=
"home"
),
url
(
r"^hero/cloud$"
,
DetailCloudView
.
as_view
(),
name
=
"detail_cloud"
),
url
(
r"^hero/sunflowey$"
,
DetailSunfloweyView
.
as_view
(),
name
=
"detail_sunflowey"
),
url
(
r"^hero/jester$"
,
DetailJesterView
.
as_view
(),
name
=
"detail_jester"
),
]
\ No newline at end of file
heroes/views.py
View file @
f9979f17
from
django.shortcuts
import
render
from
django.views.generic.base
import
TemplateView
# Create your views here.
class
HomePageView
(
TemplateView
):
template_name
=
"home.html"
class
DetailCloudView
(
TemplateView
):
template_name
=
"detail_cloud.html"
class
DetailSunfloweyView
(
TemplateView
):
template_name
=
"detail_sunflowey.html"
class
DetailJesterView
(
TemplateView
):
template_name
=
"detail_jester.html"
\ No newline at end of file
willowisp/__pycache__/urls.cpython-37.pyc
View file @
f9979f17
No preview for this file type
willowisp/urls.py
View file @
f9979f17
...
...
@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from
django.contrib
import
admin
from
django.
urls
import
path
from
django.
conf.urls
import
include
,
url
urlpatterns
=
[
path
(
'admin/'
,
admin
.
site
.
urls
),
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