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_invalid_string.py | |
| parent | b34b8a12b7f657f379c9e0e5ee7688bf36e242d2 (diff) | |
Isolated template tests from Django settings.
Diffstat (limited to 'tests/template_tests/syntax_tests/test_invalid_string.py')
| -rw-r--r-- | tests/template_tests/syntax_tests/test_invalid_string.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/tests/template_tests/syntax_tests/test_invalid_string.py b/tests/template_tests/syntax_tests/test_invalid_string.py index f56b091389..2bb8c71fd1 100644 --- a/tests/template_tests/syntax_tests/test_invalid_string.py +++ b/tests/template_tests/syntax_tests/test_invalid_string.py @@ -1,62 +1,61 @@ -from django.conf import settings from django.test import SimpleTestCase -from ..utils import render, setup +from ..utils import setup class InvalidStringTests(SimpleTestCase): @setup({'invalidstr01': '{{ var|default:"Foo" }}'}) def test_invalidstr01(self): - output = render('invalidstr01') - if settings.TEMPLATE_STRING_IF_INVALID: + output = self.engine.render_to_string('invalidstr01') + if self.engine.string_if_invalid: self.assertEqual(output, 'INVALID') else: self.assertEqual(output, 'Foo') @setup({'invalidstr02': '{{ var|default_if_none:"Foo" }}'}) def test_invalidstr02(self): - output = render('invalidstr02') - if settings.TEMPLATE_STRING_IF_INVALID: + output = self.engine.render_to_string('invalidstr02') + if self.engine.string_if_invalid: self.assertEqual(output, 'INVALID') else: self.assertEqual(output, '') @setup({'invalidstr03': '{% for v in var %}({{ v }}){% endfor %}'}) def test_invalidstr03(self): - output = render('invalidstr03') + output = self.engine.render_to_string('invalidstr03') self.assertEqual(output, '') @setup({'invalidstr04': '{% if var %}Yes{% else %}No{% endif %}'}) def test_invalidstr04(self): - output = render('invalidstr04') + output = self.engine.render_to_string('invalidstr04') self.assertEqual(output, 'No') @setup({'invalidstr04_2': '{% if var|default:"Foo" %}Yes{% else %}No{% endif %}'}) def test_invalidstr04_2(self): - output = render('invalidstr04_2') + output = self.engine.render_to_string('invalidstr04_2') self.assertEqual(output, 'Yes') @setup({'invalidstr05': '{{ var }}'}) def test_invalidstr05(self): - output = render('invalidstr05') - if settings.TEMPLATE_STRING_IF_INVALID: + output = self.engine.render_to_string('invalidstr05') + if self.engine.string_if_invalid: self.assertEqual(output, 'INVALID') else: self.assertEqual(output, '') @setup({'invalidstr06': '{{ var.prop }}'}) def test_invalidstr06(self): - output = render('invalidstr06') - if settings.TEMPLATE_STRING_IF_INVALID: + output = self.engine.render_to_string('invalidstr06') + if self.engine.string_if_invalid: self.assertEqual(output, 'INVALID') else: self.assertEqual(output, '') @setup({'invalidstr07': '{% load i18n %}{% blocktrans %}{{ var }}{% endblocktrans %}'}) def test_invalidstr07(self): - output = render('invalidstr07') - if settings.TEMPLATE_STRING_IF_INVALID: + output = self.engine.render_to_string('invalidstr07') + if self.engine.string_if_invalid: self.assertEqual(output, 'INVALID') else: self.assertEqual(output, '') |
