Commit 4eb4da22 authored by cj0125's avatar cj0125

Added functional test for recipes_update_form. Also added its corresponding...

Added functional test for recipes_update_form. Also added its corresponding html, url, and view to test it.
parent f39d80c2
<html>
<head>
<title>Recipes - Update Form</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, RecipesListView from .views import RecipesCreateFormView, RecipesDetailView, RecipesListView, RecipesUpdateFormView
urlpatterns = [ urlpatterns = [
url(r'^ingredients_create_form$',IngredientsCreateFormView.as_view(),name='ICF'), url(r'^ingredients_create_form$',IngredientsCreateFormView.as_view(),name='ICF'),
...@@ -31,5 +31,6 @@ urlpatterns = [ ...@@ -31,5 +31,6 @@ urlpatterns = [
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'), url(r'^recipes_list$',RecipesListView.as_view(),name='RL'),
url(r'^recipes_update_form$',RecipesUpdateFormView.as_view(),name='RUF'),
] ]
...@@ -41,10 +41,7 @@ class RecipesDetailView(DetailView): ...@@ -41,10 +41,7 @@ class RecipesDetailView(DetailView):
class RecipesListView(ListView): class RecipesListView(ListView):
model = None model = None
class RecipesUpdateFormView(UpdateView):
model = None
template_name = 'recipes_update_form.html'
...@@ -68,6 +68,11 @@ class NewVisitorTest(unittest.TestCase): ...@@ -68,6 +68,11 @@ class NewVisitorTest(unittest.TestCase):
self.browser.get('http://localhost:8000/recipes_list') self.browser.get('http://localhost:8000/recipes_list')
self.assertIn('Recipes - List', self.browser.title) self.assertIn('Recipes - List', self.browser.title)
self.assertIn('http://localhost:8000/recipes_list', self.browser.current_url) self.assertIn('http://localhost:8000/recipes_list', self.browser.current_url)
def test_display_RUF(self):
self.browser.get('http://localhost:8000/recipes_update_form')
self.assertIn('Recipes - Update Form', self.browser.title)
self.assertIn('http://localhost:8000/recipes_update_form', 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