Commit f39d80c2 authored by cj0125's avatar cj0125

Added functional test for recipes_list. Also added its corresponding html,...

Added functional test for recipes_list. Also added its corresponding html, url, and view to test it.
parent fa0e7fc7
<html>
<head>
<title>Recipes - List</title>
</head>
</html>
\ No newline at end of file
...@@ -17,7 +17,7 @@ Including another URLconf ...@@ -17,7 +17,7 @@ Including another URLconf
from django.conf.urls import url from django.conf.urls import url
from .views import IngredientsCreateFormView, IngredientsDetailView, IngredientsListView, IngredientsUpdateFormView from .views import IngredientsCreateFormView, IngredientsDetailView, IngredientsListView, IngredientsUpdateFormView
from .views import OrdersCreateFormView, OrdersDetailView, OrdersListView, OrdersUpdateFormView from .views import OrdersCreateFormView, OrdersDetailView, OrdersListView, OrdersUpdateFormView
from .views import RecipesCreateFormView, RecipesDetailView from .views import RecipesCreateFormView, RecipesDetailView, RecipesListView
urlpatterns = [ urlpatterns = [
url(r'^ingredients_create_form$',IngredientsCreateFormView.as_view(),name='ICF'), url(r'^ingredients_create_form$',IngredientsCreateFormView.as_view(),name='ICF'),
...@@ -30,5 +30,6 @@ urlpatterns = [ ...@@ -30,5 +30,6 @@ urlpatterns = [
url(r'^orders_update_form$',OrdersUpdateFormView.as_view(),name='OUF'), url(r'^orders_update_form$',OrdersUpdateFormView.as_view(),name='OUF'),
url(r'^recipes_create_form$',RecipesCreateFormView.as_view(),name='RCF'), url(r'^recipes_create_form$',RecipesCreateFormView.as_view(),name='RCF'),
url(r'^recipes_detail$',RecipesDetailView.as_view(),name='RD'), url(r'^recipes_detail$',RecipesDetailView.as_view(),name='RD'),
url(r'^recipes_list$',RecipesListView.as_view(),name='RL'),
] ]
...@@ -39,6 +39,9 @@ class RecipesCreateFormView(CreateView): ...@@ -39,6 +39,9 @@ class RecipesCreateFormView(CreateView):
class RecipesDetailView(DetailView): class RecipesDetailView(DetailView):
model = None model = None
class RecipesListView(ListView):
model = None
......
...@@ -63,6 +63,11 @@ class NewVisitorTest(unittest.TestCase): ...@@ -63,6 +63,11 @@ class NewVisitorTest(unittest.TestCase):
self.browser.get('http://localhost:8000/recipes_detail') self.browser.get('http://localhost:8000/recipes_detail')
self.assertIn('Recipes - Detail', self.browser.title) self.assertIn('Recipes - Detail', self.browser.title)
self.assertIn('http://localhost:8000/recipes_detail', self.browser.current_url) self.assertIn('http://localhost:8000/recipes_detail', self.browser.current_url)
def test_display_RL(self):
self.browser.get('http://localhost:8000/recipes_list')
self.assertIn('Recipes - List', self.browser.title)
self.assertIn('http://localhost:8000/recipes_list', self.browser.current_url)
self.fail('Finish the test!') self.fail('Finish the test!')
if __name__ == '__main__': if __name__ == '__main__':
......
This diff is collapsed.
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