Exemple #1
0
    def test_template_debug_conditions(self):
        request = mock.Mock()
        request.user = self.user
        request.locale = Locale.parse('en_US')

        from django.conf import settings

        settings.DEBUG = False
        settings.TEMPLATE_DEBUG = True

        context = global_context(request)
        self.assertFalse(context['is_debug'])

        settings.DEBUG = True
        settings.TEMPLATE_DEBUG = False

        context = global_context(request)
        self.assertFalse(context['is_debug'])

        settings.DEBUG = False
        settings.TEMPLATE_DEBUG = False

        context = global_context(request)
        self.assertFalse(context['is_debug'])

        settings.DEBUG = True
        settings.TEMPLATE_DEBUG = True

        context = global_context(request)
        self.assertTrue(context['is_debug'])
Exemple #2
0
    def test_template_debug_conditions(self):
        request = mock.Mock()
        request.user = self.user
        request.locale = Locale.parse('en_US')

        from django.conf import settings

        settings.DEBUG = False
        settings.TEMPLATE_DEBUG = True

        context = global_context(request)
        self.assertFalse(context['is_debug'])

        settings.DEBUG = True
        settings.TEMPLATE_DEBUG = False

        context = global_context(request)
        self.assertFalse(context['is_debug'])

        settings.DEBUG = False
        settings.TEMPLATE_DEBUG = False

        context = global_context(request)
        self.assertFalse(context['is_debug'])

        settings.DEBUG = True
        settings.TEMPLATE_DEBUG = True

        context = global_context(request)
        self.assertTrue(context['is_debug'])
Exemple #3
0
    def test_global_context(self):
        request = mock.Mock()
        request.user = self.user
        request.locale = Locale.parse('en_US')

        context = global_context(request)

        self.assertEquals(context, {
            'SITE_NAME': 'Niqels',
            'is_debug': False,
            'USE_GA': False
        })
Exemple #4
0
    def test_global_context(self):
        request = mock.Mock()
        request.user = self.user
        request.locale = Locale.parse('en_US')

        context = global_context(request)

        self.assertEquals(context, {
            'SITE_NAME': 'Niqels',
            'is_debug': False,
            'USE_GA': False
        })