Added test case for common view component
This commit is contained in:
parent
881bc20749
commit
05e738e6a9
1 changed files with 16 additions and 0 deletions
16
project/common/tests.py
Normal file
16
project/common/tests.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from django.test import TestCase
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
|
||||
class CustomTemplateTestCase(TestCase):
|
||||
def setUp(self):
|
||||
self.template = 'pages:index'
|
||||
|
||||
def test_accessable(self):
|
||||
response = self.client.get(reverse(self.template))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_context(self):
|
||||
response = self.client.get(reverse(self.template))
|
||||
for item in ['html_title', 'body_class', 'js_redirect']:
|
||||
self.assertIn(item, response.context)
|
Reference in a new issue