added html files and fixed urls and views

parent bb2d9f82
......@@ -4,3 +4,8 @@
"myenv/"
"__pycache__"
"*.pyc"
"myenv/"
"db.sqlite3"
"geckodriver.log"
"__pycache__"
"*.pyc"
<html>
<head>
<title>The Good Place</title>
</head>
<body>
<h1>The Good Place Froyo</h1>
<a href="froyo/ingredients"><h2 id="ingredients">Ingredients</h2></a>
<a href="froyo/recipes"><h2 id="recipes">Recipes</h2></a>
<a href="froyo/orders"><h2 id="orders">Orders</h2></a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Ingredients</title>
</head>
<body>
<h1>Ingredients</h1>
<a href="ingredients/list"><h2 id="list">Ingredients - List</h2></a>
<a href="ingredients/detail"><h2 id="detail">Ingredients - Detail</h2></a>
<a href="ingredients/update"><h2 id="update">Ingredients - Update</h2></a>
<a href="ingredients/create"><h2 id="create">Ingredients - Create</h2></a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Ingredients - Create</title>
</head>
<body>
<h1>Ingredients - Create</h1>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Ingredients - Detail</title>
</head>
<body>
<h1>Ingredients - Detail</h1>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Ingredients - Update</title>
</head>
<body>
<h1>Ingredients - Update</h1>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Orders</title>
</head>
<body>
<h1>Orders</h1>
<a href="orders/list"><h2 id="list">Orders - List</h2></a>
<a href="orders/detail"><h2 id="detail">Orders - Detail</h2></a>
<a href="orders/update"><h2 id="update">Orders - Update</h2></a>
<a href="orders/create"><h2 id="create">Orders - Create</h2></a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Orders - Create</title>
</head>
<body>
<h1>Orders - Create</h1>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Orders - Detail</title>
</head>
<body>
<h1>Orders - Detail</h1>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Orders - List</title>
</head>
<body>
<h1>Orders - List</h1>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Orders - Update</title>
</head>
<body>
<h1>Orders - Update</h1>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Recipes</title>
</head>
<body>
<h1>Recipes</h1>
<a href="recipes/list"><h2 id="list">Recipes - List</h2></a>
<a href="recipes/detail"><h2 id="detail">Recipes - Detail</h2></a>
<a href="recipes/update"><h2 id="update">Recipes - Update</h2></a>
<a href="recipes/create"><h2 id="create">Recipes - Create</h2></a>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Recipes - Create</title>
</head>
<body>
<h1>Recipes - Create</h1>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Recipes - Detail</title>
</head>
<body>
<h1>Recipes - Detail</h1>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Recipes - List</title>
</head>
<body>
<h1>Recipes - List</h1>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Recipes - Update</title>
</head>
<body>
<h1>Recipes - Update</h1>
</body>
</html>
\ No newline at end of file
from django.urls import path
from .views import froyo
from .views import ingredients
from .views import ingredients_list
from .views import ingredients_detail
from .views import ingredients_update
from .views import ingredients_create
from .views import recipes
from .views import recipes_list
from .views import recipes_detail
from .views import recipes_update
from .views import recipes_create
from .views import orders
from .views import orders_list
from .views import orders_detail
from .views import orders_update
from .views import orders_create
urlpatterns = [
path('froyo', froyo),
path('froyo/ingredients', ingredients),
path('froyo/ingredients/list', ingredients_list),
path('froyo/ingredients/detail', ingredients_detail),
path('froyo/ingredients/update', ingredients_update),
path('froyo/ingredients/create', ingredients_create),
path('froyo/recipes', recipes),
path('froyo/recipes/list', recipes_list),
path('froyo/recipes/detail', recipes_detail),
path('froyo/recipes/update', recipes_update),
path('froyo/recipes/create', recipes_create),
path('froyo/orders', orders),
path('froyo/orders/list', orders_list),
path('froyo/orders/detail', orders_detail),
path('froyo/orders/update', orders_update),
path('froyo/orders/create', orders_create),
]
from django.shortcuts import render
# Create your views here.
def froyo(request):
return render(request, 'froyo.html')
def ingredients(request):
return render(request, 'ingredients.html')
def ingredients_list(request):
return render(request, 'ingredients_list.html')
def ingredients_detail(request):
return render(request, 'ingredients_detail.html')
def ingredients_update(request):
return render(request, 'ingredients_update_form.html')
def ingredients_create(request):
return render(request, 'ingredients_create_form.html')
def recipes(request):
return render(request, 'recipes.html')
def recipes_list(request):
return render(request, 'recipes_list.html')
def recipes_detail(request):
return render(request, 'recipes_detail.html')
def recipes_update(request):
return render(request, 'recipes_update_form.html')
def recipes_create(request):
return render(request, 'recipes_create_form.html')
def orders(request):
return render(request, 'orders.html')
def orders_list(request):
return render(request, 'orders_list.html')
def orders_detail(request):
return render(request, 'orders_detail.html')
def orders_update(request):
return render(request, 'orders_update_form.html')
def orders_create(request):
return render(request, 'orders_create_form.html')
......@@ -13,7 +13,65 @@ class NewVisitorTest(unittest.TestCase):
def test_can_start_and_retrieve_a_list(self):
self.browser.get('http://localhost:8000/froyo')
self.assertIn('Froyo', self.browser.title)
self.assertIn('The Good Place', self.browser.title)
self.browser.get('http://localhost:8000/froyo/ingredients')
self.assertIn('Ingredients', self.browser.title)
detail = self.browser.find_element_by_id('list')
self.assertEqual(detail.get_attribute('innerHTML'), 'Ingredients - List')
detail = self.browser.find_element_by_id('detail')
self.assertEqual(detail.get_attribute('innerHTML'), 'Ingredients - Detail')
detail = self.browser.find_element_by_id('update')
self.assertEqual(detail.get_attribute('innerHTML'), 'Ingredients - Update')
detail = self.browser.find_element_by_id('create')
self.assertEqual(detail.get_attribute('innerHTML'), 'Ingredients - Create')
self.browser.get('http://localhost:8000/froyo/ingredients/list')
self.assertIn('Ingredients - List', self.browser.title)
self.browser.get('http://localhost:8000/froyo/ingredients/detail')
self.assertIn('Ingredients - Detail', self.browser.title)
self.browser.get('http://localhost:8000/froyo/ingredients/update')
self.assertIn('Ingredients - Update', self.browser.title)
self.browser.get('http://localhost:8000/froyo/ingredients/create')
self.assertIn('Ingredients - Create', self.browser.title)
self.browser.get('http://localhost:8000/froyo/recipes')
self.assertIn('Recipes', self.browser.title)
detail = self.browser.find_element_by_id('list')
self.assertEqual(detail.get_attribute('innerHTML'), 'Recipes - List')
detail = self.browser.find_element_by_id('detail')
self.assertEqual(detail.get_attribute('innerHTML'), 'Recipes - Detail')
detail = self.browser.find_element_by_id('update')
self.assertEqual(detail.get_attribute('innerHTML'), 'Recipes - Update')
detail = self.browser.find_element_by_id('create')
self.assertEqual(detail.get_attribute('innerHTML'), 'Recipes - Create')
self.browser.get('http://localhost:8000/froyo/recipes/list')
self.assertIn('Recipes - List', self.browser.title)
self.browser.get('http://localhost:8000/froyo/recipes/detail')
self.assertIn('Recipes - Detail', self.browser.title)
self.browser.get('http://localhost:8000/froyo/recipes/update')
self.assertIn('Recipes - Update', self.browser.title)
self.browser.get('http://localhost:8000/froyo/recipes/create')
self.assertIn('Recipes - Create', self.browser.title)
self.browser.get('http://localhost:8000/froyo/orders')
self.assertIn('Orders', self.browser.title)
detail = self.browser.find_element_by_id('list')
self.assertEqual(detail.get_attribute('innerHTML'), 'Orders - List')
detail = self.browser.find_element_by_id('detail')
self.assertEqual(detail.get_attribute('innerHTML'), 'Orders - Detail')
detail = self.browser.find_element_by_id('update')
self.assertEqual(detail.get_attribute('innerHTML'), 'Orders - Update')
detail = self.browser.find_element_by_id('create')
self.assertEqual(detail.get_attribute('innerHTML'), 'Orders - Create')
self.browser.get('http://localhost:8000/froyo/orders/list')
self.assertIn('Orders - List', self.browser.title)
self.browser.get('http://localhost:8000/froyo/orders/detail')
self.assertIn('Orders - Detail', self.browser.title)
self.browser.get('http://localhost:8000/froyo/orders/update')
self.assertIn('Orders - Update', self.browser.title)
self.browser.get('http://localhost:8000/froyo/orders/create')
self.assertIn('Orders - Create', self.browser.title)
self.fail('Finish the Test')
if __name__ == '__main__':
......
This diff is collapsed.
......@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('froyo.urls')),
]
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