Ejemplo n.º 1
0
 def test_check_context_processor(self):
     context_processor = "mezzanine.pages.context_processors.page"
     templates = [{"OPTIONS": {"context_processors": context_processor}}]
     expected_warning = [
         Warning(
             "You haven't included 'mezzanine.pages.context_processors.page' "
             "as a context processor in any of your template configurations. "
             "Your templates might not work as expected.",
             id="mezzanine.pages.W01",
         )
     ]
     app_config = apps.get_app_config("pages")
     with override_settings(TEMPLATES=()):
         issues = check_context_processor(app_config)
         self.assertEqual(issues, expected_warning)
     with override_settings(TEMPLATES=templates):
         issues = check_context_processor(app_config)
         self.assertEqual(issues, [])
Ejemplo n.º 2
0
 def test_check_context_processor(self):
     context_processor = 'mezzanine.pages.context_processors.page'
     templates = [{'OPTIONS': {'context_processors': context_processor}}]
     expected_warning = [Warning(
         "You haven't included 'mezzanine.pages.context_processors.page' "
         "as a context processor in any of your template configurations. "
         "Your templates might not work as expected.",
         id="mezzanine.pages.W01"
     )]
     app_config = apps.get_app_config('pages')
     with override_settings(TEMPLATES=None):
         with override_settings(TEMPLATE_CONTEXT_PROCESSORS=tuple()):
             issues = check_context_processor(app_config)
             self.assertEqual(issues, expected_warning)
         with override_settings(
                 TEMPLATE_CONTEXT_PROCESSORS=(context_processor, )):
             issues = check_context_processor(app_config)
             self.assertEqual(issues, [])
     with override_settings(TEMPLATES=templates):
         issues = check_context_processor(app_config)
         self.assertEqual(issues, [])
Ejemplo n.º 3
0
 def test_check_context_processor(self):
     context_processor = 'mezzanine.pages.context_processors.page'
     templates = [{'OPTIONS': {'context_processors': context_processor}}]
     expected_warning = [Warning(
         "You haven't included 'mezzanine.pages.context_processors.page' "
         "as a context processor in any of your template configurations. "
         "Your templates might not work as expected.",
         id="mezzanine.pages.W01"
     )]
     app_config = apps.get_app_config('pages')
     with override_settings(TEMPLATES=None):
         with override_settings(TEMPLATE_CONTEXT_PROCESSORS=tuple()):
             issues = check_context_processor(app_config)
             self.assertEqual(issues, expected_warning)
         with override_settings(
                 TEMPLATE_CONTEXT_PROCESSORS=(context_processor, )):
             issues = check_context_processor(app_config)
             self.assertEqual(issues, [])
     with override_settings(TEMPLATES=templates):
         issues = check_context_processor(app_config)
         self.assertEqual(issues, [])