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_load.py | |
| parent | b34b8a12b7f657f379c9e0e5ee7688bf36e242d2 (diff) | |
Isolated template tests from Django settings.
Diffstat (limited to 'tests/template_tests/syntax_tests/test_load.py')
| -rw-r--r-- | tests/template_tests/syntax_tests/test_load.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/tests/template_tests/syntax_tests/test_load.py b/tests/template_tests/syntax_tests/test_load.py index 96c657582b..711a9da632 100644 --- a/tests/template_tests/syntax_tests/test_load.py +++ b/tests/template_tests/syntax_tests/test_load.py @@ -1,72 +1,71 @@ -from django.template.base import TemplateSyntaxError -from django.template.loader import get_template +from django.template import TemplateSyntaxError from django.test import SimpleTestCase -from ..utils import render, setup +from ..utils import setup class LoadTagTests(SimpleTestCase): @setup({'load01': '{% load testtags subpackage.echo %}{% echo test %} {% echo2 "test" %}'}) def test_load01(self): - output = render('load01') + output = self.engine.render_to_string('load01') self.assertEqual(output, 'test test') @setup({'load02': '{% load subpackage.echo %}{% echo2 "test" %}'}) def test_load02(self): - output = render('load02') + output = self.engine.render_to_string('load02') self.assertEqual(output, 'test') # {% load %} tag, importing individual tags @setup({'load03': '{% load echo from testtags %}{% echo this that theother %}'}) def test_load03(self): - output = render('load03') + output = self.engine.render_to_string('load03') self.assertEqual(output, 'this that theother') @setup({'load04': '{% load echo other_echo from testtags %}' '{% echo this that theother %} {% other_echo and another thing %}'}) def test_load04(self): - output = render('load04') + output = self.engine.render_to_string('load04') self.assertEqual(output, 'this that theother and another thing') @setup({'load05': '{% load echo upper from testtags %}' '{% echo this that theother %} {{ statement|upper }}'}) def test_load05(self): - output = render('load05', {'statement': 'not shouting'}) + output = self.engine.render_to_string('load05', {'statement': 'not shouting'}) self.assertEqual(output, 'this that theother NOT SHOUTING') @setup({'load06': '{% load echo2 from subpackage.echo %}{% echo2 "test" %}'}) def test_load06(self): - output = render('load06') + output = self.engine.render_to_string('load06') self.assertEqual(output, 'test') # {% load %} tag errors @setup({'load07': '{% load echo other_echo bad_tag from testtags %}'}) def test_load07(self): with self.assertRaises(TemplateSyntaxError): - get_template('load07') + self.engine.get_template('load07') @setup({'load08': '{% load echo other_echo bad_tag from %}'}) def test_load08(self): with self.assertRaises(TemplateSyntaxError): - get_template('load08') + self.engine.get_template('load08') @setup({'load09': '{% load from testtags %}'}) def test_load09(self): with self.assertRaises(TemplateSyntaxError): - get_template('load09') + self.engine.get_template('load09') @setup({'load10': '{% load echo from bad_library %}'}) def test_load10(self): with self.assertRaises(TemplateSyntaxError): - get_template('load10') + self.engine.get_template('load10') @setup({'load11': '{% load subpackage.echo_invalid %}'}) def test_load11(self): with self.assertRaises(TemplateSyntaxError): - get_template('load11') + self.engine.get_template('load11') @setup({'load12': '{% load subpackage.missing %}'}) def test_load12(self): with self.assertRaises(TemplateSyntaxError): - get_template('load12') + self.engine.get_template('load12') |
