diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-12-07 09:43:10 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-12-28 16:23:01 +0100 |
| commit | 92a2d049a253fb499db88efb6cf6c9209f6f251c (patch) | |
| tree | bd3c913883b36f918f3c8ae7af942a8c8f50a23f /tests/template_tests/syntax_tests/test_exceptions.py | |
| parent | b34b8a12b7f657f379c9e0e5ee7688bf36e242d2 (diff) | |
Isolated template tests from Django settings.
Diffstat (limited to 'tests/template_tests/syntax_tests/test_exceptions.py')
| -rw-r--r-- | tests/template_tests/syntax_tests/test_exceptions.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/template_tests/syntax_tests/test_exceptions.py b/tests/template_tests/syntax_tests/test_exceptions.py index be313d8e76..e3645cb13f 100644 --- a/tests/template_tests/syntax_tests/test_exceptions.py +++ b/tests/template_tests/syntax_tests/test_exceptions.py @@ -1,10 +1,8 @@ -from django.conf import settings -from django.template.base import TemplateDoesNotExist, TemplateSyntaxError -from django.template.loader import get_template +from django.template import TemplateDoesNotExist, TemplateSyntaxError from django.test import SimpleTestCase from .test_extends import inheritance_templates -from ..utils import render, setup +from ..utils import setup class ExceptionsTests(SimpleTestCase): @@ -15,19 +13,19 @@ class ExceptionsTests(SimpleTestCase): Raise exception for invalid template name """ with self.assertRaises(TemplateDoesNotExist): - render('exception01') + self.engine.render_to_string('exception01') @setup({'exception02': '{% extends nonexistent %}'}) def test_exception02(self): """ Raise exception for invalid variable template name """ - if settings.TEMPLATE_STRING_IF_INVALID: + if self.engine.string_if_invalid: with self.assertRaises(TemplateDoesNotExist): - render('exception02') + self.engine.render_to_string('exception02') else: with self.assertRaises(TemplateSyntaxError): - render('exception02') + self.engine.render_to_string('exception02') @setup( {'exception03': "{% extends 'inheritance01' %}" @@ -39,7 +37,7 @@ class ExceptionsTests(SimpleTestCase): Raise exception for extra {% extends %} tags """ with self.assertRaises(TemplateSyntaxError): - get_template('exception03') + self.engine.get_template('exception03') @setup( {'exception04': "{% extends 'inheritance17' %}{% block first %}{% echo 400 %}5678{% endblock %}"}, @@ -50,7 +48,7 @@ class ExceptionsTests(SimpleTestCase): Raise exception for custom tags used in child with {% load %} tag in parent, not in child """ with self.assertRaises(TemplateSyntaxError): - get_template('exception04') + self.engine.get_template('exception04') @setup({'exception05': '{% block first %}{{ block.super }}{% endblock %}'}) def test_exception05(self): @@ -58,4 +56,4 @@ class ExceptionsTests(SimpleTestCase): Raise exception for block.super used in base template """ with self.assertRaises(TemplateSyntaxError): - render('exception05') + self.engine.render_to_string('exception05') |
