Commit 907b44ab authored by John Carlos Sanil's avatar John Carlos Sanil

Merge branch 'ingredients-branch' into 'develop'

Unit Tested and Created Ingredients Views

See merge request !6
parents f742b982 16d64c39
...@@ -2,5 +2,7 @@ ...@@ -2,5 +2,7 @@
<head> <head>
<title>The Good Place FroYo Shop</title> <title>The Good Place FroYo Shop</title>
</head> </head>
<h1>The Good Place FroYo Shop</h1> <body>
<h1>The Good Place FroYo Shop</h1>
</body>
</html> </html>
<html>
<head>
<title>Ingredients - Update</title>
</head>
<body>
<h1>Ingredients - Update</h1>
</body>
</html>
<html>
<head>
<title>Ingredients - Detail</title>
</head>
<body>
<h1>Ingredients - Detail</h1>
</body>
</html>
<html>
<head>
<title>Ingredients - List</title>
</head>
<body>
<h1>Ingredients - List</h1>
</body>
</html>
<html>
<head>
<title>Ingredients - Update</title>
</head>
<body>
<h1>Ingredients - Update</h1>
</body>
</html>
...@@ -8,3 +8,21 @@ class HomePageTest(TestCase): ...@@ -8,3 +8,21 @@ class HomePageTest(TestCase):
response = self.client.get('/') response = self.client.get('/')
self.assertTemplateUsed(response, 'home.html') self.assertTemplateUsed(response, 'home.html')
class IngredientsPageTests(TestCase):
def test_ingredients_list_returns_correct_html(self):
response = self.client.get('/ingredients_list')
self.assertTemplateUsed(response, 'ingredients_list.html')
def test_ingredients_detail_returns_correct_html(self):
response = self.client.get('/ingredients_detail')
self.assertTemplateUsed(response, 'ingredients_detail.html')
def test_ingredients_update_returns_correct_html(self):
response = self.client.get('/ingredients_update_form')
self.assertTemplateUsed(response, 'ingredients_update_form.html')
def test_ingredients_create_returns_correct_html(self):
response = self.client.get('/ingredients_create_form')
self.assertTemplateUsed(response, 'ingredients_create_form.html')
\ No newline at end of file
from django.conf.urls import url from django.conf.urls import url
from .views import HomePageView from .views import HomePageView, IngredientsListView, IngredientsDetailView, IngredientsUpdateView, IngredientsCreateView
urlpatterns = [ urlpatterns = [
url(r'^$', HomePageView.as_view(), name='home'), url(r'^$', HomePageView.as_view(), name='home'),
url(r'^ingredients_list$', IngredientsListView.as_view(), name='ingredients_list'),
url(r'^ingredients_detail$', IngredientsDetailView.as_view(), name='ingredients_detail'),
url(r'^ingredients_update_form$', IngredientsUpdateView.as_view(), name='ingredients_update_form'),
url(r'^ingredients_create_form$', IngredientsCreateView.as_view(), name='ingredients_create_form')
] ]
\ No newline at end of file
...@@ -5,4 +5,16 @@ from django.views.generic.base import TemplateView ...@@ -5,4 +5,16 @@ from django.views.generic.base import TemplateView
# Create your views here. # Create your views here.
class HomePageView(TemplateView): class HomePageView(TemplateView):
template_name = "home.html" template_name = "home.html"
\ No newline at end of file
class IngredientsListView(TemplateView):
template_name = "ingredients_list.html"
class IngredientsDetailView(TemplateView):
template_name = "ingredients_detail.html"
class IngredientsUpdateView(TemplateView):
template_name = "ingredients_update_form.html"
class IngredientsCreateView(TemplateView):
template_name = "ingredients_create_form.html"
\ No newline at end of file
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