Commit 8abb34f8 authored by cj0125's avatar cj0125

Added functional test to orders_create_form. Also added its corresponding...

Added functional test to orders_create_form. Also added its corresponding html, url, and view to test it.
parent f5f65351
<html>
<head>
<title>Orders - Create Form</title>
</head>
</html>
\ No newline at end of file
...@@ -15,12 +15,13 @@ Including another URLconf ...@@ -15,12 +15,13 @@ 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, OrdersCreateFormView
urlpatterns = [ urlpatterns = [
url(r'^ingredients_create_form$',IngredientsCreateFormView.as_view(),name='ICF'), url(r'^ingredients_create_form$',IngredientsCreateFormView.as_view(),name='ICF'),
url(r'^ingredients_detail$',IngredientsDetailView.as_view(),name='ID'), url(r'^ingredients_detail$',IngredientsDetailView.as_view(),name='ID'),
url(r'^ingredients_list$', IngredientsListView.as_view(), name='IL'), url(r'^ingredients_list$', IngredientsListView.as_view(), name='IL'),
url(r'^ingredients_update_form$',IngredientsUpdateFormView.as_view(),name='IUF'), url(r'^ingredients_update_form$',IngredientsUpdateFormView.as_view(),name='IUF'),
url(r'^orders_create_form$',OrdersCreateFormView.as_view(),name='OCF'),
] ]
...@@ -18,3 +18,8 @@ class IngredientsUpdateFormView(UpdateView): ...@@ -18,3 +18,8 @@ class IngredientsUpdateFormView(UpdateView):
model = None model = None
template_name = 'ingredients_update_form.html' template_name = 'ingredients_update_form.html'
class OrdersCreateFormView(CreateView):
model = None
template_name = 'orders_create_form.html'
...@@ -28,13 +28,18 @@ class NewVisitorTest(unittest.TestCase): ...@@ -28,13 +28,18 @@ class NewVisitorTest(unittest.TestCase):
self.browser.get('http://localhost:8000/ingredients_list') self.browser.get('http://localhost:8000/ingredients_list')
self.assertIn('Ingredients - List', self.browser.title) self.assertIn('Ingredients - List', self.browser.title)
self.assertIn('http://localhost:8000/ingredients_list', self.browser.current_url) self.assertIn('http://localhost:8000/ingredients_list', self.browser.current_url)
self.fail('Finish the test!')
def test_display_IUF(self): def test_display_IUF(self):
self.browser.get('http://localhost:8000/ingredients_update_form') self.browser.get('http://localhost:8000/ingredients_update_form')
self.assertIn('Ingredients - Update Form', self.browser.title) self.assertIn('Ingredients - Update Form', self.browser.title)
self.assertIn('http://localhost:8000/ingredients_update_form', self.browser.current_url) self.assertIn('http://localhost:8000/ingredients_update_form', self.browser.current_url)
def test_display_OCF(self):
self.browser.get('http://localhost:8000/orders_create_form')
self.assertIn('Orders - Create Form', self.browser.title)
self.assertIn('http://localhost:8000/orders_create_form', self.browser.current_url)
self.fail('Finish the test!')
if __name__ == '__main__': if __name__ == '__main__':
unittest.main(warnings = 'ignore') unittest.main(warnings = 'ignore')
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