Commit d9b75d3c authored by Kirby Ezekiel Santos's avatar Kirby Ezekiel Santos

Added a test for checking if the ingredients create page returns the correct html template

parent 7d93f9fd
......@@ -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')
......@@ -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())
]
......@@ -23,3 +23,6 @@ class IngredientsListView(ListView):
class IngredientsDetailView(TemplateView):
template_name = "ingredients_detail.html"
class IngredientsUpdateView(TemplateView):
template_name = "ingredients_update_form.html"
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment