Commit 23cf62d9 authored by cj0125's avatar cj0125

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

Added functional test to ingredients_detail. Also added its corresponding html, url, and view to test it.
parent 8afb41ab
<html>
<head>
<title>Ingredients - Detail</title>
</head>
</html>
\ No newline at end of file
...@@ -15,9 +15,10 @@ Including another URLconf ...@@ -15,9 +15,10 @@ Including another URLconf
""" """
from django.conf.urls import url from django.conf.urls import url
from .views import IngredientsCreateFormView from .views import IngredientsCreateFormView, IngredientsDetailView
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'),
] ]
...@@ -7,3 +7,6 @@ from django.views.generic.edit import UpdateView, CreateView ...@@ -7,3 +7,6 @@ from django.views.generic.edit import UpdateView, CreateView
class IngredientsCreateFormView(CreateView): class IngredientsCreateFormView(CreateView):
model = None model = None
template_name = 'ingredients_create_form.html' template_name = 'ingredients_create_form.html'
class IngredientsDetailView(DetailView):
model = None
...@@ -18,8 +18,13 @@ class NewVisitorTest(unittest.TestCase): ...@@ -18,8 +18,13 @@ class NewVisitorTest(unittest.TestCase):
self.browser.get('http://localhost:8000/ingredients_create_form') self.browser.get('http://localhost:8000/ingredients_create_form')
self.assertIn('Ingredients - Create Form', self.browser.title) self.assertIn('Ingredients - Create Form', self.browser.title)
self.assertIn('http://localhost:8000/ingredients_create_form', self.browser.current_url) self.assertIn('http://localhost:8000/ingredients_create_form', self.browser.current_url)
def test_display_ID(self):
self.browser.get('http://localhost:8000/ingredients_detail')
self.assertIn('Ingredients - Detail', self.browser.title)
self.assertIn('http://localhost:8000/ingredients_detail', self.browser.current_url)
self.fail('Finish the test!') 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