UPD: dav_base: tests!
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user