Commit 6defcce2 authored by littleredpanda14's avatar littleredpanda14

Created tests and urls. Updated views.

parent 0b2f51e9
<!DOCTYPE html>
<html>
<head>
<title>Hi. My name is Janet.</title>
</head>
<body>
<h1>Hi. My name is Janet.</h1>
Welcome. Everything is fine.
</body>
</html>
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
class JanetPageTest(TestCase):
def test_janet_page_returns_correct_html(self):
response = self.client.get('/froyo')
self.assertTemplateUsed(response, 'janet.html')
class IngredientsListPageTest(TestCase):
def test_ingredients_list_page_returns_correct_html(self):
response = self.client.get('/froyo/ingredients')
self.assertTemplateUsed(response, 'ingredients_list.html')
class IngredientsListPageTest(TestCase):
def test_ingredients_list_page_returns_correct_html(self):
response = self.client.get('/froyo/ingredients')
self.assertTemplateUsed(response, 'ingredients_list.html')
from django.conf.urls import url, include
from .views import JanetView
from .views import IngredientsListView, IngredientsDetailView, IngredientsUpdateView, IngredientsCreateView
......@@ -13,6 +16,9 @@ from .views import OrdersListView, OrdersDetailView, OrdersUpdateView, OrdersCre
urlpatterns = [
url(r'^froyo$', HeroesView.as_view(), name='hero_list'),
url(r'^ingredients/almonds$', JesterView.as_view(), name='jester_detail')
url(r'^froyo$', JanetView.as_view(), name='janet'),
url(r'^froyo/ingredients$', IngredientsListView.as_view(), name='ingredients_list'),
url(r'^froyo/ingredients/almonds$', IngredientsDetailView.as_view(), name='almonds'),
url(r'^froyo/ingredients/update$', IngredientsUpdateView.as_view(), name='ingredients_update'),
url(r'^froyo/ingredients/create$', IngredientsCreateView.as_view(), name='ingredients_create'),
]
\ No newline at end of file
from django.shortcuts import render
from django.views.generic.base import ListView, DetailView, UpdateView, CreateView
from django.views.generic.base import TemplateView
from django.views.generic import ListView, DetailView, UpdateView, CreateView
class JanetView(TemplateView):
template_name = 'janet.html'
class IngredientsListView(ListView):
template_name = 'ingredients_list.html'
......@@ -45,10 +57,10 @@ class OrdersDetailView(DetailView):
template_name = 'orders_detail.html'
class IngredientUpdateView(UpdateView):
class OrdersUpdateView(UpdateView):
template_name = 'orders_update_form.html'
class IngredientCreateView(CreateView):
class OrdersCreateView(CreateView):
template_name = 'orders_create_form.html'
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