Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TheGoodPlace
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
Christian Paul Penaflor
TheGoodPlace
Commits
f1ee09f5
Commit
f1ee09f5
authored
Mar 17, 2020
by
Christian Paul Penaflor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created Unit Test to Detect if template is found
parent
ed35d549
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
61 additions
and
21 deletions
+61
-21
homepage.html
froyo/templates/homepage.html
+16
-0
tests.py
froyo/tests.py
+8
-1
urls.py
froyo/urls.py
+1
-2
views.py
froyo/views.py
+13
-13
functional_tests.py
functional_tests.py
+16
-1
settings.py
superlists/settings.py
+3
-1
urls.py
superlists/urls.py
+1
-1
settings.py
thegoodplace/thegoodplace/settings.py
+1
-1
urls.py
thegoodplace/thegoodplace/urls.py
+2
-1
No files found.
froyo/templates/homepage.html
0 → 100644
View file @
f1ee09f5
<html>
<head>
<title>
Lets Make Froyo
</title>
</head>
<body>
<h1
id=
"Froyo Heading"
>
Froyo
</h1>
<dl>
<dt>
Ingredients
</dt>
<dt>
Recipes
</dt>
<dt>
Orders
</dt>
</dl>
</body>
</html>
\ No newline at end of file
froyo/tests.py
View file @
f1ee09f5
from
django.test
import
TestCase
from
django.urls
import
resolve
from
django.http
import
HttpRequest
# Create your tests here.
from
.views
import
home_page
class
PageTest
(
TestCase
):
def
test_home_page_is
(
self
):
response
=
self
.
client
.
get
(
'/froyo'
)
self
.
assertTemplateUsed
(
response
,
'homepage.html'
)
\ No newline at end of file
froyo/urls.py
View file @
f1ee09f5
...
...
@@ -14,8 +14,7 @@ from .views import orders_update_form_page
from
.views
import
orders_create_form_page
urlpatterns
=
[
url
(
r'^$'
,
home_page
.
as_view
(),
name
=
'home_page'
),
url
(
r'^froyo/$'
,
home_page
.
as_view
(),
name
=
'home_page'
),
url
(
r'^froyo$'
,
home_page
.
as_view
(),
name
=
'home_page'
),
url
(
r'^froyo/ingredients_list$'
,
ingredients_list_page
.
as_view
(),
name
=
'ingredients_list'
),
url
(
r'^froyo/ingredients_detail$'
,
ingredients_detail_page
.
as_view
(),
name
=
'ingredients_detail'
),
url
(
r'^froyo/ingredients_update_form$'
,
ingredients_update_form_page
.
as_view
(),
name
=
'ingredients_update_form'
),
...
...
froyo/views.py
View file @
f1ee09f5
from
django.views.generic.base
import
TemplateView
class
home_page
(
TemplateView
):
template_name
=
'
froyo/
homepage.html'
template_name
=
'homepage.html'
class
ingredients_list_page
(
TemplateView
):
template_name
=
'
froyo/
ingredients_list.html'
template_name
=
'ingredients_list.html'
class
ingredients_detail_page
(
TemplateView
):
template_name
=
'
froyo/
ingredients_detail.html'
template_name
=
'ingredients_detail.html'
class
ingredients_update_form_page
(
TemplateView
):
template_name
=
'
froyo/
ingredients_update_form.html'
template_name
=
'ingredients_update_form.html'
class
ingredients_create_form_page
(
TemplateView
):
template_name
=
'
froyo/
ingredients_create_form.html'
template_name
=
'ingredients_create_form.html'
class
recipes_list_page
(
TemplateView
):
template_name
=
'
froyo/
recipes_list.html'
template_name
=
'recipes_list.html'
class
recipes_detail_page
(
TemplateView
):
template_name
=
'
froyo/
recipes_detail.html'
template_name
=
'recipes_detail.html'
class
recipes_update_form_page
(
TemplateView
):
template_name
=
'
froyo/
recipes_update_form.html'
template_name
=
'recipes_update_form.html'
class
recipes_create_form_page
(
TemplateView
):
template_name
=
'
froyo/
recipes_create_form.html'
template_name
=
'recipes_create_form.html'
class
orders_list_page
(
TemplateView
):
template_name
=
'
froyo/
orders_list.html'
template_name
=
'orders_list.html'
class
orders_detail_page
(
TemplateView
):
template_name
=
'
froyo/
orders_detail.html'
template_name
=
'orders_detail.html'
class
orders_update_form_page
(
TemplateView
):
template_name
=
'
froyo/
orders_update_form.html'
template_name
=
'orders_update_form.html'
class
orders_create_form_page
(
TemplateView
):
template_name
=
'
froyo/
orders_create_form.html'
template_name
=
'orders_create_form.html'
functional_tests.py
View file @
f1ee09f5
...
...
@@ -2,3 +2,18 @@ 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_models_and_their_views
(
self
):
self
.
browser
.
get
(
'http://localhost:8000'
)
# Check if the title of the homepage is Let's Make Froyo
self
.
assertIn
(
'Lets Make Froyo'
,
self
.
browser
.
title
)
self
.
fail
(
'Finish the test!'
)
if
__name__
==
'__main__'
:
unittest
.
main
(
warnings
=
'ignore'
)
\ No newline at end of file
superlists/settings.py
View file @
f1ee09f5
...
...
@@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'froyo'
]
MIDDLEWARE
=
[
...
...
@@ -47,6 +48,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware'
,
'django.contrib.messages.middleware.MessageMiddleware'
,
'django.middleware.clickjacking.XFrameOptionsMiddleware'
,
]
ROOT_URLCONF
=
'superlists.urls'
...
...
@@ -54,7 +56,7 @@ ROOT_URLCONF = 'superlists.urls'
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[],
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'templates'
)
],
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'context_processors'
:
[
...
...
superlists/urls.py
View file @
f1ee09f5
...
...
@@ -13,7 +13,7 @@ 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
=
[
...
...
thegoodplace/thegoodplace/settings.py
View file @
f1ee09f5
...
...
@@ -55,7 +55,7 @@ ROOT_URLCONF = 'thegoodplace.urls'
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[],
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'templates'
)
],
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'context_processors'
:
[
...
...
thegoodplace/thegoodplace/urls.py
View file @
f1ee09f5
...
...
@@ -13,9 +13,10 @@ 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
url
,
include
from
django.contrib
import
admin
urlpatterns
=
[
url
(
r'^admin/'
,
admin
.
site
.
urls
),
url
(
r''
,
include
(
'froyo.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