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
Kirby Ezekiel Santos
thegoodplace
Commits
d9b75d3c
Commit
d9b75d3c
authored
Mar 18, 2020
by
Kirby Ezekiel Santos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a test for checking if the ingredients create page returns the correct html template
parent
7d93f9fd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
1 deletion
+28
-1
tests.py
froyo/tests.py
+10
-0
urls.py
froyo/urls.py
+3
-1
views.py
froyo/views.py
+3
-0
ingredients_detail.html
templates/ingredients_detail.html
+12
-0
No files found.
froyo/tests.py
View file @
d9b75d3c
...
...
@@ -15,3 +15,13 @@ class IngredientsDetailPageTest(TestCase):
def
test_ingredients_detail_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/ingredients-detail'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_detail.html'
)
class
IngredientsUpdatePageTest
(
TestCase
):
def
test_ingredients_update_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/ingredients-update'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_update_form.html'
)
class
IngredientsCreatePageTest
(
TestCase
):
def
test_ingredients_create_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/ingredients-create'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_create_form.html'
)
froyo/urls.py
View file @
d9b75d3c
...
...
@@ -3,9 +3,11 @@ from django.urls import path
from
.views
import
HomePageView
from
.views
import
IngredientsListView
from
.views
import
IngredientsDetailView
from
.views
import
IngredientsUpdateView
urlpatterns
=
[
path
(
''
,
HomePageView
.
as_view
()),
path
(
'ingredients-list'
,
IngredientsListView
.
as_view
()),
path
(
'ingredients-detail'
,
IngredientsDetailView
.
as_view
())
path
(
'ingredients-detail'
,
IngredientsDetailView
.
as_view
()),
path
(
'ingredients-update'
,
IngredientsUpdateView
.
as_view
())
]
froyo/views.py
View file @
d9b75d3c
...
...
@@ -23,3 +23,6 @@ class IngredientsListView(ListView):
class
IngredientsDetailView
(
TemplateView
):
template_name
=
"ingredients_detail.html"
class
IngredientsUpdateView
(
TemplateView
):
template_name
=
"ingredients_update_form.html"
templates/ingredients_detail.html
View file @
d9b75d3c
...
...
@@ -25,5 +25,17 @@
</tbody>
</table>
</div>
<div>
<form
method=
"get"
action=
"http://localhost:8000/ingredients-update"
>
<button
type=
"submit"
id=
"button_to_ingredients_update"
>
Update Fields
</button>
</form>
</div>
<div>
<form
method=
"get"
action=
"http://localhost:8000/ingredients-list"
>
<button
type=
"submit"
id=
"back_button"
>
Back to List
</button>
</form>
</div>
</body>
</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