Esempio n. 1
0
 def test_get_match_extension(self):
     if django.VERSION[:2] < (1, 8):
         self.assertEquals(
             getattr(settings, 'DEFAULT_JINJA2_TEMPLATE_EXTENSION',
                     '.jinja'), get_match_extension())
     else:
         from django_jinja.backend import Jinja2
         self.assertEquals(Jinja2.get_default().match_extension,
                           get_match_extension())
Esempio n. 2
0
    def test_get_match_extension_using(self):
        setting = {
            "append": [
                {
                    "BACKEND": "django_jinja.backend.Jinja2",
                    "NAME": "jinja2dup",
                    "APP_DIRS": True,
                    "OPTIONS": {"match_extension": ".jinjadup"},
                }
            ]
        }

        with self.modify_settings(TEMPLATES=setting):
            self.assertEquals(".jinja", get_match_extension(using="jinja2"))
            self.assertEquals(".jinjadup", get_match_extension(using="jinja2dup"))
Esempio n. 3
0
    def test_get_match_extension_using(self):
        setting = {
            "append": [{
                "BACKEND": "django_jinja.backend.Jinja2",
                "NAME": "jinja2dup",
                "APP_DIRS": True,
                "OPTIONS": {
                    "match_extension": ".jinjadup",
                }
            }]
        }

        with self.modify_settings(TEMPLATES=setting):
            self.assertEquals(".jinja", get_match_extension(using='jinja2'))
            self.assertEquals(".jinjadup",
                              get_match_extension(using="jinja2dup"))
Esempio n. 4
0
    def test_get_match_extension(self):
        if django.VERSION[:2] < (1, 8):
            self.assertEquals(getattr(settings, "DEFAULT_JINJA2_TEMPLATE_EXTENSION", ".jinja"), get_match_extension())
        else:
            from django_jinja.backend import Jinja2

            self.assertEquals(Jinja2.get_default().match_extension, get_match_extension())
Esempio n. 5
0
 def test_get_match_extension_using(self):
     with self.modify_settings(TEMPLATES={
         'append': [{"BACKEND": "django_jinja.backend.Jinja2",
             "NAME": "jinja2dup",
             "APP_DIRS": True,
             "OPTIONS": {
                 "match_extension": ".jinjadup",
                 "context_processors": [
                    "django.contrib.auth.context_processors.auth",
                    "django.template.context_processors.debug",
                    "django.template.context_processors.i18n",
                    "django.template.context_processors.media",
                    "django.template.context_processors.static",
                    "django.template.context_processors.tz",
                    "django.contrib.messages.context_processors.messages",
                 ],
                 "constants": {
                    "foo": "bar",
                 },
                 "extensions": settings.JINJA2_EXTENSIONS
             }}],
     }):
         self.assertEquals(".jinja", get_match_extension(using='jinja2'))
         self.assertEquals(".jinjadup", get_match_extension(using="jinja2dup"))
Esempio n. 6
0
 def test_get_match_extension(self):
     self.assertEquals(Jinja2.get_default().match_extension,
                       get_match_extension())