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)
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)
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')
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')
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)
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)