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
ab6ba34f
Commit
ab6ba34f
authored
Mar 06, 2020
by
Patrick James Ong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Followed slidesets for tests, urls, and views
parent
debd1400
Pipeline
#821
canceled with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
0 deletions
+56
-0
tests.py
willowisp/heroes/tests.py
+28
-0
urls.py
willowisp/heroes/urls.py
+10
-0
views.py
willowisp/heroes/views.py
+18
-0
No files found.
willowisp/heroes/tests.py
View file @
ab6ba34f
from
django.test
import
TestCase
from
django.urls
import
resolve
from
django.http
import
HttpRequest
# Create your tests here.
class
HomePageTest
(
TestCase
):
def
test_uses_home_template
(
self
):
response
=
self
.
client
.
get
(
'/'
)
self
.
assertTemplateUsed
(
response
,
'home.html'
)
class
CloudPageTest
(
TestCase
):
def
test_uses_hero_template
(
self
):
response
=
self
.
client
.
get
(
'/cloud/'
)
self
.
assertTemplateUsed
(
response
,
'detail_cloud.html'
)
class
JesterPageTest
(
TestCase
):
def
test_uses_hero_template
(
self
):
response
=
self
.
client
.
get
(
'/jester/'
)
self
.
assertTemplateUsed
(
response
,
'detailed_jester.html'
)
class
SunfloweyPageTest
(
TestCase
):
def
test_uses_hero_template
(
self
):
response
=
self
.
client
.
get
(
'/sunflowey/'
)
self
.
assertTemplateUsed
(
response
,
'detailed_sunflowey.html'
)
willowisp/heroes/urls.py
0 → 100644
View file @
ab6ba34f
from
django.conf.urls
import
url
from
.views
import
HomeListView
,
CloudDetailView
,
JesterDetailView
,
SunfloweyDetailView
urlpatterns
=
[
url
(
r'^$'
,
HomeListView
.
as_view
(),
name
=
'home'
),
url
(
r'^cloud/$'
,
CloudDetailView
.
as_view
(),
name
=
'detail_cloud'
),
url
(
r'^jester/$'
,
JesterDetailView
.
as_view
(),
name
=
'detail_jester'
),
url
(
r'^sunflowey/$'
,
SunfloweyDetailView
.
as_view
(),
name
=
'detail_sunflowey'
),
]
willowisp/heroes/views.py
View file @
ab6ba34f
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.views.generic.base
import
TemplateView
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
# Create your views here.
class
HomeListView
(
ListView
):
template_name
=
'home.html'
class
CloudDetailView
(
DetailView
):
template_name
=
'detail_cloud.html'
class
JesterDetailView
(
DetailView
):
template_name
=
'detail_jester.html'
class
SunfloweyDetailView
(
DetailView
):
template_name
=
'detail_sunflowey.html'
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