Пример #1
0
    def test_check_detects_unexistant_template(self):
        unexistant = ('does_not_exists.html', 'foo')
        with self.settings(PAGE_TEMPLATES=[unexistant]):
            errors = page_templates_loading_check([])

        self.assertEqual(errors, [Warning(
            'Django cannot find template does_not_exists.html',
            obj=unexistant, id='pages.W001')])
Пример #2
0
    def test_check_detects_unexistant_template(self):
        unexistant = ('does_not_exists.html', 'foo')
        with self.settings(PAGE_TEMPLATES=[unexistant]):
            errors = page_templates_loading_check([])

        self.assertEqual(errors, [
            Warning('Django cannot find template does_not_exists.html',
                    obj=unexistant,
                    id='pages.W001')
        ])
Пример #3
0
 def test_template_syntax_error_is_not_silenced(self):
     with self.settings(PAGE_TEMPLATES=[('syntax_error.html', 'fail')]):
         with self.assertRaises(TemplateSyntaxError):
             page_templates_loading_check([])
Пример #4
0
    def test_check_doesnt_warn_on_existing_templates(self):
        with self.settings(PAGE_TEMPLATES=[('pages/contact.html', 'bas')]):
            errors = page_templates_loading_check([])

        self.assertEquals(errors, [])
Пример #5
0
 def test_template_syntax_error_is_not_silenced(self):
     with self.settings(PAGE_TEMPLATES=[('syntax_error.html', 'fail')]):
         with self.assertRaises(TemplateSyntaxError):
             page_templates_loading_check([])
Пример #6
0
    def test_check_doesnt_warn_on_existing_templates(self):
        with self.settings(PAGE_TEMPLATES=[('pages/contact.html', 'bas')]):
            errors = page_templates_loading_check([])

        self.assertEquals(errors, [])