Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Midterm-Project-186050-Columbres-v2
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
Alysha Columbres
Midterm-Project-186050-Columbres-v2
Commits
541d04aa
Commit
541d04aa
authored
Mar 19, 2020
by
Alysha Columbres
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created and tested the views for the recipes model
parent
8035d270
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
112 additions
and
2 deletions
+112
-2
recipes_create_form.html
froyo/templates/recipes_create_form.html
+6
-0
recipes_detail.html
froyo/templates/recipes_detail.html
+6
-0
recipes_list.html
froyo/templates/recipes_list.html
+6
-0
recipes_update_form.html
froyo/templates/recipes_update_form.html
+6
-0
tests.py
froyo/tests.py
+29
-1
urls.py
froyo/urls.py
+5
-1
views.py
froyo/views.py
+18
-0
functional_test.py
functional_test.py
+36
-0
No files found.
froyo/templates/recipes_create_form.html
0 → 100644
View file @
541d04aa
<!DOCTYPE html>
<html>
<head>
<title>
Recipes - Create
</title>
</head>
</html>
\ No newline at end of file
froyo/templates/recipes_detail.html
0 → 100644
View file @
541d04aa
<!DOCTYPE html>
<html>
<head>
<title>
Recipes - Detail
</title>
</head>
</html>
\ No newline at end of file
froyo/templates/recipes_list.html
0 → 100644
View file @
541d04aa
<!DOCTYPE html>
<html>
<head>
<title>
Recipes - List
</title>
</head>
</html>
\ No newline at end of file
froyo/templates/recipes_update_form.html
0 → 100644
View file @
541d04aa
<!DOCTYPE html>
<html>
<head>
<title>
Recipes - Update
</title>
</head>
</html>
\ No newline at end of file
froyo/tests.py
View file @
541d04aa
...
...
@@ -26,4 +26,32 @@ class IngredientsCreateFormPageTest(TestCase):
def
test_ingredients_create_form_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/ingredients_create_form_page'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_create_form.html'
)
\ No newline at end of file
self
.
assertTemplateUsed
(
response
,
'ingredients_create_form.html'
)
class
RecipesListPageTest
(
TestCase
):
def
test_recipes_list_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/recipes_list_page'
)
self
.
assertTemplateUsed
(
response
,
'recipes_list.html'
)
class
RecipesDetailPageTest
(
TestCase
):
def
test_recipes_detail_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/recipes_detail_page'
)
self
.
assertTemplateUsed
(
response
,
'recipes_detail.html'
)
class
RecipesUpdateFormPageTest
(
TestCase
):
def
test_recipes_update_form_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/recipes_update_form_page'
)
self
.
assertTemplateUsed
(
response
,
'recipes_update_form.html'
)
class
RecipesCreateFormPageTest
(
TestCase
):
def
test_recipes_create_form_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/recipes_create_form_page'
)
self
.
assertTemplateUsed
(
response
,
'recipes_create_form.html'
)
\ No newline at end of file
froyo/urls.py
View file @
541d04aa
from
django.conf.urls
import
url
from
.views
import
IngredientsListView
,
IngredientsDetailView
,
IngredientsUpdateFormView
,
IngredientsCreateFormView
from
.views
import
IngredientsListView
,
IngredientsDetailView
,
IngredientsUpdateFormView
,
IngredientsCreateFormView
,
RecipesListView
,
RecipesDetailView
,
RecipesUpdateFormView
,
RecipesCreateFormView
urlpatterns
=
[
url
(
r'^ingredients_list_page$'
,
IngredientsListView
.
as_view
(),
name
=
'Ingredients_List_View'
),
url
(
r'^ingredients_detail_page$'
,
IngredientsDetailView
.
as_view
(),
name
=
'Ingredients_Detail_View'
),
url
(
r'^ingredients_update_form_page$'
,
IngredientsUpdateFormView
.
as_view
(),
name
=
'Ingredients_Update_Form_View'
),
url
(
r'^ingredients_create_form_page$'
,
IngredientsCreateFormView
.
as_view
(),
name
=
'Ingredients_Create_Form_View'
),
url
(
r'^recipes_list_page$'
,
RecipesListView
.
as_view
(),
name
=
'Recipes_List_View'
),
url
(
r'^recipes_detail_page$'
,
RecipesDetailView
.
as_view
(),
name
=
'Recipes_Detail_View'
),
url
(
r'^recipes_update_form_page$'
,
RecipesUpdateFormView
.
as_view
(),
name
=
'Recipes_Update_Form_View'
),
url
(
r'^recipes_create_form_page$'
,
RecipesCreateFormView
.
as_view
(),
name
=
'Recipes_Create_Form_View'
),
]
\ No newline at end of file
froyo/views.py
View file @
541d04aa
...
...
@@ -18,5 +18,23 @@ class IngredientsUpdateFormView(UpdateView):
class
IngredientsCreateFormView
(
CreateView
):
model
=
None
template_name_suffix
=
'_create_form'
class
RecipesListView
(
ListView
):
model
=
None
class
RecipesDetailView
(
DetailView
):
model
=
None
class
RecipesUpdateFormView
(
UpdateView
):
model
=
None
template_name_suffix
=
'_update_form'
class
RecipesCreateFormView
(
CreateView
):
model
=
None
template_name_suffix
=
'_create_form'
\ No newline at end of file
functional_test.py
View file @
541d04aa
...
...
@@ -53,5 +53,41 @@ class NewVisitorTest(unittest.TestCase):
self
.
browser
.
getCurrentUrl
()
)
# employee opens recipes list page and checks title
def
test_can_open_recipes_list_page
(
self
):
self
.
browser
.
get
(
'http://localhost:8000/recipes_list_page'
)
self
.
assertIn
(
'Recipes - List'
,
self
.
browser
.
title
)
self
.
assertEqual
(
'http://localhost:8000/recipes_list_page'
,
self
.
browser
.
getCurrentUrl
()
)
# employee opens recipes detail page and checks title
def
test_can_open_recipes_detail_page
(
self
):
self
.
browser
.
get
(
'http://localhost:8000/recipes_detail_page'
)
self
.
assertIn
(
'Recipes - Detail'
,
self
.
browser
.
title
)
self
.
assertEqual
(
'http://localhost:8000/recipes_detail_page'
,
self
.
browser
.
getCurrentUrl
()
)
# employee opens recipes update form page and checks title
def
test_can_open_recipes_update_form_page
(
self
):
self
.
browser
.
get
(
'http://localhost:8000/recipes_update_form_page'
)
self
.
assertIn
(
'Recipes - Update'
,
self
.
browser
.
title
)
self
.
assertEqual
(
'http://localhost:8000/recipes_update_form_page'
,
self
.
browser
.
getCurrentUrl
()
)
# employee opens recipes create form page and checks title
def
test_can_open_recipes_create_form_page
(
self
):
self
.
browser
.
get
(
'http://localhost:8000/recipes_create_form_page'
)
self
.
assertIn
(
'Recipes - Create'
,
self
.
browser
.
title
)
self
.
assertEqual
(
'http://localhost:8000/recipes_create_form_page'
,
self
.
browser
.
getCurrentUrl
()
)
if
__name__
==
'__main__'
:
unittest
.
main
(
warnings
=
'ignore'
)
\ No newline at end of file
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