From 05e738e6a9d2e32cc21d2b608e3747631a6d5295 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 10 Jan 2016 21:23:55 +0000 Subject: [PATCH] Added test case for common view component --- project/common/tests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 project/common/tests.py diff --git a/project/common/tests.py b/project/common/tests.py new file mode 100644 index 0000000..7ed1e4d --- /dev/null +++ b/project/common/tests.py @@ -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)