from __future__ import unicode_literals from django.conf import settings from django.test import SimpleTestCase class TemplatesTestCase(SimpleTestCase): def setUp(self): super().setUp() self.response_from_root_view = self.client.get('/') def test_template_usage(self): response = self.response_from_root_view self.assertTemplateUsed(response, 'dav_base/base.html') self.assertTemplateUsed(response, 'project_name.html') def test_html_head(self): response = self.response_from_root_view static_url = settings.STATIC_URL html_needles = ( # favicon '', # bootstrap css '', # css file for jquery.dataTables.js '', # local css file '', # jquery.js file '', # jquery.dataTables.js file '', # bootstrap js file '', ) content = response.content.decode('utf-8') for needle in html_needles: needle = needle.format(static_url=static_url) self.assertInHTML(needle, content) def test_page_footer(self): response = self.response_from_root_view html = """ """ self.assertInHTML(html, response.content.decode('utf-8'))