Commit 9be21ac5 authored by Keith Adrian Santos's avatar Keith Adrian Santos

added the recipes codes to froyo views, urls and test. Ran Test.py and...

added the recipes codes to froyo views, urls and test. Ran Test.py and functional_test.py and both work error free wahoo.
parent e694b153
from django.test import TestCase from django.test import TestCase
# Test Cases for Home Pages! # Test Cases for Home Pages!
class FroyoHomePageTest(TestCase): class FroyoHomePageTest(TestCase):
def test_froyo_home_page_returns_correct_html(self): def test_froyo_home_page_returns_correct_html(self):
...@@ -21,6 +22,7 @@ class RecipesPageTest(TestCase): ...@@ -21,6 +22,7 @@ class RecipesPageTest(TestCase):
response = self.client.get('/recipes') response = self.client.get('/recipes')
self.assertTemplateUsed(response, 'recipes_home.html') self.assertTemplateUsed(response, 'recipes_home.html')
#Test Cases for Ingredient Pages! #Test Cases for Ingredient Pages!
class IngredientsListPageTest(TestCase): class IngredientsListPageTest(TestCase):
def test_ingredients_list_page_returns_correct_html(self): def test_ingredients_list_page_returns_correct_html(self):
...@@ -63,3 +65,25 @@ class OrdersCreatePageTest(TestCase): ...@@ -63,3 +65,25 @@ class OrdersCreatePageTest(TestCase):
def test_orders_create_page_returns_correct_html(self): def test_orders_create_page_returns_correct_html(self):
response = self.client.get('/orders/create') response = self.client.get('/orders/create')
self.assertTemplateUsed(response, 'orders_create_form.html') self.assertTemplateUsed(response, 'orders_create_form.html')
#Test Cases for Recipes Pages!
class RecipesListPageTest(TestCase):
def test_recipes_list_page_returns_correct_html(self):
response = self.client.get('/recipes/list')
self.assertTemplateUsed(response, 'recipes_list.html')
class RecipesDetailPageTest(TestCase):
def test_recipes_detail_page_returns_correct_html(self):
response = self.client.get('/recipes/detail')
self.assertTemplateUsed(response, 'recipes_detail.html')
class RecipesUpdatePageTest(TestCase):
def test_recipes_update_page_returns_correct_html(self):
response = self.client.get('/recipes/update')
self.assertTemplateUsed(response, 'recipes_update_form.html')
class RecipesCreatePageTest(TestCase):
def test_recipes_create_page_returns_correct_html(self):
response = self.client.get('/recipes/create')
self.assertTemplateUsed(response, 'recipes_create_form.html')
\ No newline at end of file
from django.conf.urls import url from django.conf.urls import url
from.views import FroyoView, IngredientsHomeView, OrdersHomeView, RecipesHomeView from.views import FroyoView, IngredientsHomeView, OrdersHomeView, RecipesHomeView
from.views import IngredientsListView, IngredientsDetailView, IngredientsUpdateView, IngredientsCreateView from.views import IngredientsListView, IngredientsDetailView, IngredientsUpdateView, IngredientsCreateView
from.views import OrdersListView, OrdersDetailView, OrdersUpdateView, OrdersCreateView from.views import OrdersListView, OrdersDetailView, OrdersUpdateView, OrdersCreateView
from.views import RecipesListView, RecipesDetailView, RecipesUpdateView, RecipesCreateView
urlpatterns = [ urlpatterns = [
url(r'^$',FroyoView.as_view(),name='froyo_home'), url(r'^$',FroyoView.as_view(),name='froyo_home'),
url(r'^ingredients$',IngredientsHomeView.as_view(),name='ingredients_home'), url(r'^ingredients$',IngredientsHomeView.as_view(),name='ingredients_home'),
...@@ -19,4 +24,9 @@ urlpatterns = [ ...@@ -19,4 +24,9 @@ urlpatterns = [
url(r'^orders/detail$',OrdersDetailView.as_view(),name='orders_detail'), url(r'^orders/detail$',OrdersDetailView.as_view(),name='orders_detail'),
url(r'^orders/update$',OrdersUpdateView.as_view(),name='orders_update_form'), url(r'^orders/update$',OrdersUpdateView.as_view(),name='orders_update_form'),
url(r'^orders/create$',OrdersCreateView.as_view(),name='orders_create_form'), url(r'^orders/create$',OrdersCreateView.as_view(),name='orders_create_form'),
url(r'^recipes/list$',RecipesListView.as_view(),name='recipes_list'),
url(r'^recipes/detail$',RecipesDetailView.as_view(),name='recipes_detail'),
url(r'^recipes/update$',RecipesUpdateView.as_view(),name='recipes_update_form'),
url(r'^recipes/create$',RecipesCreateView.as_view(),name='recipes_create_form'),
] ]
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
#I'll use TemplateView for all bec the others views need SQL ata and we won't do models pa right? #I'll use TemplateView for all bec the others views need SQL ata and we won't do models pa right?
#Views for Home Pages #Views for Home Pages
class FroyoView(TemplateView): class FroyoView(TemplateView):
template_name = "froyo_home.html" template_name = "froyo_home.html"
...@@ -39,3 +42,16 @@ class OrdersUpdateView(TemplateView): ...@@ -39,3 +42,16 @@ class OrdersUpdateView(TemplateView):
class OrdersCreateView(TemplateView): class OrdersCreateView(TemplateView):
template_name = "orders_create_form.html" template_name = "orders_create_form.html"
#Views for Recipes Pages
class RecipesListView(TemplateView):
template_name = "recipes_list.html"
class RecipesDetailView(TemplateView):
template_name = "recipes_detail.html"
class RecipesUpdateView(TemplateView):
template_name = "recipes_update_form.html"
class RecipesCreateView(TemplateView):
template_name = "recipes_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