Commit 8513dc0a authored by cj0125's avatar cj0125

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

Added functional test for orders_detail. Also added its corresponding html, url, and view to test it.
parent 8abb34f8
<html>
<head>
<title>Orders - Detail</title>
</head>
</html>
\ No newline at end of file
...@@ -15,7 +15,7 @@ Including another URLconf ...@@ -15,7 +15,7 @@ Including another URLconf
""" """
from django.conf.urls import url from django.conf.urls import url
from .views import IngredientsCreateFormView, IngredientsDetailView, IngredientsListView, IngredientsUpdateFormView, OrdersCreateFormView from .views import IngredientsCreateFormView, IngredientsDetailView, IngredientsListView, IngredientsUpdateFormView, OrdersCreateFormView, OrdersDetailView
urlpatterns = [ urlpatterns = [
url(r'^ingredients_create_form$',IngredientsCreateFormView.as_view(),name='ICF'), url(r'^ingredients_create_form$',IngredientsCreateFormView.as_view(),name='ICF'),
...@@ -23,5 +23,6 @@ urlpatterns = [ ...@@ -23,5 +23,6 @@ urlpatterns = [
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'), url(r'^orders_create_form$',OrdersCreateFormView.as_view(),name='OCF'),
url(r'^orders_detail$',OrdersDetailView.as_view(),name='OD'),
] ]
...@@ -21,5 +21,9 @@ class IngredientsUpdateFormView(UpdateView): ...@@ -21,5 +21,9 @@ class IngredientsUpdateFormView(UpdateView):
class OrdersCreateFormView(CreateView): class OrdersCreateFormView(CreateView):
model = None model = None
template_name = 'orders_create_form.html' template_name = 'orders_create_form.html'
class OrdersDetailView(DetailView):
model = None
...@@ -38,6 +38,11 @@ class NewVisitorTest(unittest.TestCase): ...@@ -38,6 +38,11 @@ class NewVisitorTest(unittest.TestCase):
self.browser.get('http://localhost:8000/orders_create_form') self.browser.get('http://localhost:8000/orders_create_form')
self.assertIn('Orders - Create Form', self.browser.title) self.assertIn('Orders - Create Form', self.browser.title)
self.assertIn('http://localhost:8000/orders_create_form', self.browser.current_url) self.assertIn('http://localhost:8000/orders_create_form', self.browser.current_url)
def test_display_OD(self):
self.browser.get('http://localhost:8000/orders_detail')
self.assertIn('Orders - Detail', self.browser.title)
self.assertIn('http://localhost:8000/orders_detail', 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