Commit 65de3d66 authored by Joaquin's avatar Joaquin

URLS thegoodplace, TemplateView

parent 11af5350
File added
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Ingredients Create Form</title> <title>Ingredients Create</title>
</head> </head>
<body> <body>
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Ingredients Update Form</title> <title>Ingredients Update</title>
</head> </head>
<body> <body>
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Orders Create Form</title> <title>Orders Create</title>
</head> </head>
<body> <body>
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Orders Update Form</title> <title>Orders Update</title>
</head> </head>
<body> <body>
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Recipes Create Form</title> <title>Recipes Create</title>
</head> </head>
<body> <body>
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>recipes_list</title> <title>Recipes List</title>
</head> </head>
<body> <body>
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Recipes Update Form</title> <title>Recipes Update</title>
</head> </head>
<body> <body>
......
from django.shortcuts import render from django.shortcuts import render
from django.views.generic import ListView, DetailView, UpdateView, CreateView from django.views.generic import TemplateView
# Create your views here. # Create your views here.
class IngredientsListView(ListView): class IngredientsListView(TemplateView):
template_name = 'ingredients_list.html' template_name = 'ingredients_list.html'
class IngredientsDetailView(DetailView): class IngredientsDetailView(TemplateView):
template_name = 'ingredients_detail.html' template_name = 'ingredients_detail.html'
class IngredientsUpdateView(UpdateView): class IngredientsUpdateView(TemplateView):
template_name = 'ingredients_update_form.html' template_name = 'ingredients_update_form.html'
class IngredientsCreateView(CreateView): class IngredientsCreateView(TemplateView):
template_name = 'ingredients_create_form.html' template_name = 'ingredients_create_form.html'
class RecipesListView(ListView): class RecipesListView(TemplateView):
template_name = 'recipes_list.html' template_name = 'recipes_list.html'
class RecipesDetailView(DetailView): class RecipesDetailView(TemplateView):
template_name = 'recipes_detail.html' template_name = 'recipes_detail.html'
class RecipesUpdateView(UpdateView): class RecipesUpdateView(TemplateView):
template_name = 'recipes_update_form.html' template_name = 'recipes_update_form.html'
class RecipesCreateView(ListView): class RecipesCreateView(TemplateView):
template_name = 'recipes_create_form.html' template_name = 'recipes_create_form.html'
class OrdersListView(ListView): class OrdersListView(TemplateView):
template_name = 'orders_list.html' template_name = 'orders_list.html'
class OrdersDetailView(ListView): class OrdersDetailView(TemplateView):
template_name = 'orders_detail.html' template_name = 'orders_detail.html'
class OrdersUpdateListView(ListView): class OrdersUpdateView(TemplateView):
template_name = 'orders_update_form.html' template_name = 'orders_update_form.html'
class OrdersCreateView(ListView): class OrdersCreateView(TemplateView):
template_name = 'orders_create_form.html' template_name = 'orders_create_form.html'
from selenium import webdriver
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def teardown(self):
self.browser.quit()
def test_can_display_ingredients_list(self):
self.browser.get('http://localhost:8000/ingredients_list')
self.assertIn('Ingredients List', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/ingredients_list')
def test_can_display_ingredients_detail(self):
self.browser.get('http://localhost:8000/ingredients_detail')
self.assertIn('Ingredients Detail', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/ingredients_detail')
def test_can_display_ingredients_update(self):
self.browser.get('http://localhost:8000/ingredients_update')
self.assertIn('Ingredients Update', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/ingredients_update')
def test_can_display_ingredients_create(self):
self.browser.get('http://localhost:8000/ingredients_create')
self.assertIn('Ingredients Create', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/ingredients_create')
def test_can_display_recipes_list(self):
self.browser.get('http://localhost:8000/recipes_list')
self.assertIn('Recipes List', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/recipes_list')
def test_can_display_recipes_detail(self):
self.browser.get('http://localhost:8000/recipes_detail')
self.assertIn('Recipes Detail', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/recipes_detail')
def test_can_display_recipes_update(self):
self.browser.get('http://localhost:8000/recipes_update')
self.assertIn('Recipes Update', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/recipes_update')
def test_can_display_recipes_create(self):
self.browser.get('http://localhost:8000/recipes_create')
self.assertIn('Recipes Create', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/recipes_create')
def test_can_display_orders_list(self):
self.browser.get('http://localhost:8000/orders_list')
self.assertIn('Orders List', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/orders_list')
def test_can_display_orders_detail(self):
self.browser.get('http://localhost:8000/orders_detail')
self.assertIn('Orders Detail', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/orders_detail')
def test_can_display_orders_update(self):
self.browser.get('http://localhost:8000/orders_update')
self.assertIn('Orders Update', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/orders_update')
def test_can_display_orders_create(self):
self.browser.get('http://localhost:8000/orders_create')
self.assertIn('Orders Create', self.browser.title)
self.assertIn(self.browser.current_url, 'http://localhost:8000/orders_create')
self.fail('The Test is Finished!')
if __name__ == '__main__':
unittest.main(warnings = 'ignore')
\ No newline at end of file
This diff is collapsed.
...@@ -37,6 +37,7 @@ INSTALLED_APPS = [ ...@@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'froyo',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
......
...@@ -13,9 +13,10 @@ Including another URLconf ...@@ -13,9 +13,10 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include 1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
""" """
from django.conf.urls import url from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'', 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