示例#1
0
 def test_template_loader_skips_non_django_backends(self):
     template_setting = [{
         'BACKEND': 'nondjango.templates',
         'OPTIONS': {'loaders': [('nondjango.templates.Loader',)]},
     }]
     with override_settings(TEMPLATES=template_setting):
         errors = checks.check_cached_template_loader_used()
         self.assertEqual(len(errors), 0)
示例#2
0
 def test_template_loader_skips_non_django_backends(self):
     template_setting = [{
         'BACKEND': 'nondjango.templates',
         'OPTIONS': {'loaders': [('nondjango.templates.Loader',)]},
     }]
     with override_settings(TEMPLATES=template_setting):
         errors = checks.check_cached_template_loader_used()
         self.assertEqual(len(errors), 0)
示例#3
0
 def test_template_loader_missing(self):
     template_setting = [{
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
         'OPTIONS': {'loaders': [('django.template.loaders.filesystem.Loader',)]},
     }]
     with override_settings(TEMPLATES=template_setting):
         errors = checks.check_cached_template_loader_used()
         self.assertEqual(len(errors), 1)
         self.assertEqual(errors[0].id, 'djangae.E003')
示例#4
0
 def test_template_loader_missing(self):
     template_setting = [{
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
         'OPTIONS': {'loaders': [('django.template.loaders.filesystem.Loader',)]},
     }]
     with override_settings(TEMPLATES=template_setting):
         errors = checks.check_cached_template_loader_used()
         self.assertEqual(len(errors), 1)
         self.assertEqual(errors[0].id, 'djangae.E003')
示例#5
0
 def test_template_loader_present(self):
     template_setting = [{
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
         'OPTIONS': {'loaders': [
             ('django.template.loaders.cached.Loader', ('django.template.loaders.filesystem.Loader',)),
         ]},
     }]
     with override_settings(TEMPLATES=template_setting):
         errors = checks.check_cached_template_loader_used()
         self.assertEqual(len(errors), 0)
示例#6
0
 def test_template_loader_present(self):
     template_setting = [{
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
         'OPTIONS': {'loaders': [
             ('django.template.loaders.cached.Loader', ('django.template.loaders.filesystem.Loader',)),
         ]},
     }]
     with override_settings(TEMPLATES=template_setting):
         errors = checks.check_cached_template_loader_used()
         self.assertEqual(len(errors), 0)