Files
django-dav-events/dav_base/tests/test_views.py

25 lines
914 B
Python

from django.test import SimpleTestCase
from ..views import RootView
class ViewsTestCase(SimpleTestCase):
def test_root(self):
view = RootView()
template_names = view.get_template_names()
self.assertEqual(len(template_names), 1)
self.assertIn('dav_base/root.html', template_names)
context = view.get_context_data()
self.assertIn('root_urls', context)
self.assertIsInstance(context['root_urls'], list)
def test_integrated_root(self):
response = self.client.get('/')
self.assertTemplateUsed(response, 'dav_base/root.html')
self.assertIn('root_urls', response.context, '\'root_urls\' not in context of root view')
self.assertIsInstance(response.context['root_urls'], list)
# TODO
# Maybe we should set a defined module config, so we could
# test the content of the root_urls context variable.