Commit ff80a723 authored by Jason's avatar Jason

Updated views, urls and tests to include the 12 required templates. Revised...

Updated views, urls and tests to include the 12 required templates. Revised part of the story in the functional test.
parent eef377d7
......@@ -5,4 +5,88 @@ class GoodPlaceHomepageTest(TestCase):
def test_home_page_returns_correct_html(self):
response = self.client.get('/froyo_homepage')
self.assertTemplateUsed(response, "froyo_homepage.html")
\ No newline at end of file
self.assertTemplateUsed(response, "froyo_homepage.html")
class IngredientsCreateFormTest(TestCase):
def test_ingredients_create_form_returns_correct_html(self):
response = self.client.get('/froyo/ingredients_create_form')
self.assertTemplateUsed(response, "ingredients_create_form.html")
class IngredientsDetailTest(TestCase):
def test_ingredients_detail_returns_correct_html(self):
response = self.client.get('/froyo/ingredients_detail')
self.assertTemplateUsed(response, "ingredients_detail.html")
class IngredientsListTest(TestCase):
def test_ingredients_list_returns_correct_html(self):
response = self.client.get('/froyo/ingredients_list')
self.assertTemplateUsed(response, "ingredients_list.html")
class IngredientsUpdateFormTest(TestCase):
def test_ingredients_update_form_returns_correct_html(self):
response = self.client.get('/froyo/ingredients_update_form')
self.assertTemplateUsed(response, "ingredients_update_form.html")
class OrdersCreateFormTest(TestCase):
def test_orders_create_form_returns_correct_html(self):
response = self.client.get('/froyo/orders_create_form')
self.assertTemplateUsed(response, "orders_create_form.html")
class OrdersDetailTest(TestCase):
def test_orders_detail_returns_correct_html(self):
response = self.client.get('/froyo/orders_detail')
self.assertTemplateUsed(response, "orders_detail.html")
class OrdersListTest(TestCase):
def test_orders_list_returns_correct_html(self):
response = self.client.get('/froyo/orders_list')
self.assertTemplateUsed(response, "orders_list.html")
class OrdersUpdateFormTest(TestCase):
def test_orders_update_form_returns_correct_html(self):
response = self.client.get('/froyo/orders_update_form')
self.assertTemplateUsed(response, "orders_update_form.html")
class RecipesCreateFormTest(TestCase):
def test_recipes_create_form_returns_correct_html(self):
response = self.client.get('/froyo/recipes_create_form')
self.assertTemplateUsed(response, "recipes_create_form.html")
class RecipesDetailTest(TestCase):
def test_recipes_detail_returns_correct_html(self):
response = self.client.get('/froyo/recipes_detail')
self.assertTemplateUsed(response, "recipes_detail.html")
class RecipesListTest(TestCase):
def test_recipes_list_returns_correct_html(self):
response = self.client.get('/froyo/recipes_list')
self.assertTemplateUsed(response, "recipes_list.html")
class RecipesUpdateFormTest(TestCase):
def test_recipes_update_form_returns_correct_html(self):
response = self.client.get('/froyo/recipes_update_form')
self.assertTemplateUsed(response, "recipes_update_form.html")
from django.conf.urls import url
from .views import FroyoView
from .views import FroyoView, \
IngCreateFormView, IngDetailView, IngListView, IngUpdateFormView, \
OrdCreateFormView, OrdDetailView, OrdListView, OrdUpdateFormView, \
RecCreateFormView, RecDetailView, RecListView, RecUpdateFormView
urlpatterns = [
url(r'^froyo_homepage$', FroyoView.as_view(), name='froyo_list')
url(r'^froyo_homepage$', FroyoView.as_view(), name='froyo_homepage'),
url(r'^froyo/ingredients_create_form$', IngCreateFormView.as_view(), name='ingredients_create_form'),
url(r'^froyo/ingredients_detail$', IngDetailView.as_view(), name='ingredients_detail'),
url(r'^froyo/ingredients_list$', IngListView.as_view(), name='ingredients_list'),
url(r'^froyo/ingredients_update_form$', IngUpdateFormView.as_view(), name='ingredients_update_form'),
url(r'^froyo/orders_create_form$', OrdCreateFormView.as_view(), name='orders_create_form'),
url(r'^froyo/orders_detail$', OrdDetailView.as_view(), name='orders_detail'),
url(r'^froyo/orders_list$', OrdListView.as_view(), name='orders_list'),
url(r'^froyo/orders_update_form$', OrdUpdateFormView.as_view(), name='orders_update_form'),
url(r'^froyo/recipes_create_form$', RecCreateFormView.as_view(), name='recipes_create_form'),
url(r'^froyo/recipes_detail$', RecDetailView.as_view(), name='recipes_detail'),
url(r'^froyo/recipes_list$', RecListView.as_view(), name='recipes_list'),
url(r'^froyo/recipes_update_form$', RecUpdateFormView.as_view(), name='recipes_update_form')
]
\ No newline at end of file
......@@ -3,4 +3,52 @@ from django.views.generic.base import TemplateView
class FroyoView(TemplateView):
template_name = 'froyo_homepage.html'
\ No newline at end of file
template_name = 'froyo_homepage.html'
class IngCreateFormView(TemplateView):
template_name = 'ingredients_create_form.html'
class IngDetailView(TemplateView):
template_name = 'ingredients_detail.html'
class IngListView(TemplateView):
template_name = 'ingredients_list.html'
class IngUpdateFormView(TemplateView):
template_name = 'ingredients_update_form.html'
class OrdCreateFormView(TemplateView):
template_name = 'orders_create_form.html'
class OrdDetailView(TemplateView):
template_name = 'orders_detail.html'
class OrdListView(TemplateView):
template_name = 'orders_list.html'
class OrdUpdateFormView(TemplateView):
template_name = 'orders_update_form.html'
class RecCreateFormView(TemplateView):
template_name = 'recipes_create_form.html'
class RecDetailView(TemplateView):
template_name = 'recipes_detail.html'
class RecListView(TemplateView):
template_name = 'recipes_list.html'
class RecUpdateFormView(TemplateView):
template_name = 'recipes_update_form.html'
\ No newline at end of file
import unittest
from selenium import webdriver
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser - webdriver.Firefox()
def tearDown(self):
self.browser.quit()
def test_can_display_a_heroes_list_and_more_information_per_hero(self):
# Laura looks at the status from a yogurt shop open during the quarantine called
# The Good Place Froyo Shop.
# She decides to visit the shop's page:
self.browser.get('http://localhost:8000')
# She sees the page title and header mention
# 'The Good Place FroYo Shop'
self.assertIn('The Good Place FroYo Shop', self.browser.title)
# She sees 12 templates and decides to click on one.
# When she selects one of the templates , she is sent to another page
# containing the function of the template.
template = self.browser.find_element_by_id('ingredients_list')
template.click()
time.sleep(1)
self.assertEqual(
'http://localhost:8000/froyo/ingredients_list',
self.browser.getCurrentUrl()
)
self.fail('Finish the test!')
if __name__ == '__main__':
unittest.main(warnings= 'ignore')
\ 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