コード例 #1
0
 def test_get_template_directories_with_empty_template_dirs(self):
     """Should return an empty set if TEMPLATE_DIRS is empty, but TEMPLATES
     is not defined"""
     if hasattr(settings, 'TEMPLATES'):
         del settings.TEMPLATES
     self.TEMPLATE_DIRS = ()
     settings.TEMPLATE_DIRS = ()
     self.assertEqual(util.get_template_directories(), set())
コード例 #2
0
 def test_get_template_directories_with_empty_template_dirs(self):
     """Should return an empty set if TEMPLATE_DIRS is empty, but TEMPLATES
     is not defined"""
     if hasattr(settings, 'TEMPLATES'):
         del settings.TEMPLATES
     self.TEMPLATE_DIRS = ()
     settings.TEMPLATE_DIRS = ()
     self.assertEqual(util.get_template_directories(), set())
コード例 #3
0
 def test_get_template_directories_with_templates(self):
     """Should return a set of DIRS from TEMPLATES if those are defined."""
     self.TEMPLATE_DIRS = ()
     if hasattr(settings, 'TEMPLATE_DIRS'):
         del settings.TEMPLATE_DIRS
     settings.TEMPLATES = [{
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
         'DIRS': ["other_templates"],
     }]
     self.assertEqual(util.get_template_directories(), {'other_templates'})
コード例 #4
0
 def test_get_template_directories_with_templates(self):
     """Should return a set of DIRS from TEMPLATES if those are defined."""
     self.TEMPLATE_DIRS = ()
     if hasattr(settings, 'TEMPLATE_DIRS'):
         del settings.TEMPLATE_DIRS
     settings.TEMPLATES = [{
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
         'DIRS': ["other_templates"],
     }]
     self.assertEqual(util.get_template_directories(), {'other_templates'})
コード例 #5
0
 def test_get_template_directories_with_empty_template_dirs(self):
     """Should return an empty set if TEMPLATES is empty, but TEMPLATES
     is not defined"""
     self.assertEqual(util.get_template_directories(), set())
コード例 #6
0
 def test_get_template_directories_with_template_dirs(self):
     """Should return the value of TEMPLATES if it exists and is not empty"""
     self.assertEqual(util.get_template_directories(), {'templates'})
コード例 #7
0
 def test_get_template_directories_with_templates(self):
     """Should return a set of DIRS from TEMPLATES if those are defined."""
     self.assertEqual(util.get_template_directories(), {'other_templates'})