UPD: dav_base: tests!

This commit is contained in:
2019-03-12 18:13:19 +01:00
parent c38cc0d6e5
commit b246a785b7
11 changed files with 432 additions and 45 deletions

View File

@@ -1,10 +1,22 @@
from django.test import TestCase, Client
from django.test import SimpleTestCase
from ..views import RootView
class ViewsTestCase(TestCase):
def setUp(self):
self.client = Client()
class ViewsTestCase(SimpleTestCase):
def test_root(self):
response = self.client.get('/', follow=False)
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)
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')
# TODO
# Maybe we should set a defined module config, so we could
# test the content of the root_urls context variable.