start test implementation for contact_form
This commit is contained in:
parent
c5d9673ac3
commit
e51d202abd
2 changed files with 33 additions and 0 deletions
4
gnuviechadmin/contact_form/tests/__init__.py
Normal file
4
gnuviechadmin/contact_form/tests/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
"""
|
||||
Tests for the :py:mod:`contact_form` app.
|
||||
|
||||
"""
|
29
gnuviechadmin/contact_form/tests/test_views.py
Normal file
29
gnuviechadmin/contact_form/tests/test_views.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
"""
|
||||
Tests for :py:mod:`contact_form.views`.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
class ContactFormViewTest(TestCase):
|
||||
|
||||
def test_get_contact_form_template(self):
|
||||
response = self.client.get(reverse('contact_form'))
|
||||
self.assertTemplateUsed(response, 'contact_form/contact_form.html')
|
||||
|
||||
def test_get_contact_form_anonymous_status(self):
|
||||
response = self.client.get(reverse('contact_form'))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_get_contact_form_anonymous_has_empty_form(self):
|
||||
response = self.client.get(reverse('contact_form'))
|
||||
self.assertIn('form', response.context)
|
||||
self.assertEqual(len(response.context['form'].initial), 0)
|
||||
|
||||
def test_get_contact_form_fields_anonymous(self):
|
||||
response = self.client.get(reverse('contact_form'))
|
||||
for name in ('name', 'email', 'body'):
|
||||
self.assertIn(name, response.context['form'].fields)
|
Loading…
Reference in a new issue