Converted recently refactored templates tests to SimpleTestCase.
These test methods don't need DB setup/teardown.
Refs #23768 and b872134b
.
This commit is contained in:
parent
2cd19f3738
commit
16f26defa7
|
@ -1,11 +1,11 @@
|
|||
from django.template.base import TemplateSyntaxError
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from .utils import render, setup, SafeClass, UnsafeClass
|
||||
|
||||
|
||||
class AutoescapeTagTests(TestCase):
|
||||
class AutoescapeTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'autoescape-tag01': '{% autoescape off %}hello{% endautoescape %}'})
|
||||
def test_autoescape_tag01(self):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf import settings
|
||||
from django.template.base import Context, TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup, SilentGetItemClass, SilentAttrClass, SomeClass
|
||||
|
||||
|
@ -13,7 +13,7 @@ basic_templates = {
|
|||
}
|
||||
|
||||
|
||||
class BasicSyntaxTests(TestCase):
|
||||
class BasicSyntaxTests(SimpleTestCase):
|
||||
|
||||
@setup(basic_templates)
|
||||
def test_basic_syntax01(self):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class BuiltinsTests(TestCase):
|
||||
class BuiltinsTests(SimpleTestCase):
|
||||
|
||||
@setup({'builtins01': '{{ True }}'})
|
||||
def test_builtins01(self):
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
from django.core.cache import cache
|
||||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class CacheTagTests(TestCase):
|
||||
class CacheTagTests(SimpleTestCase):
|
||||
|
||||
def tearDown(self):
|
||||
cache.clear()
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class CommentSyntaxTests(TestCase):
|
||||
class CommentSyntaxTests(SimpleTestCase):
|
||||
|
||||
@setup({'comment-syntax01': '{# this is hidden #}hello'})
|
||||
def test_comment_syntax01(self):
|
||||
|
|
|
@ -2,13 +2,13 @@ import warnings
|
|||
|
||||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class CycleTagTests(TestCase):
|
||||
class CycleTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'cycle01': '{% cycle a %}'})
|
||||
def test_cycle01(self):
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
from django.conf import settings
|
||||
from django.template.base import TemplateDoesNotExist, TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .test_extends import inheritance_templates
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class ExceptionsTests(TestCase):
|
||||
class ExceptionsTests(SimpleTestCase):
|
||||
|
||||
@setup({'exception01': "{% extends 'nonexistent' %}"})
|
||||
def test_exception01(self):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.template.base import Template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
@ -57,7 +57,7 @@ inheritance_templates = {
|
|||
}
|
||||
|
||||
|
||||
class InheritanceTests(TestCase):
|
||||
class InheritanceTests(SimpleTestCase):
|
||||
|
||||
@setup(inheritance_templates)
|
||||
def test_inheritance01(self):
|
||||
|
|
|
@ -5,13 +5,13 @@ import warnings
|
|||
from django.conf import settings
|
||||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from .utils import render, setup, SomeClass, SomeOtherException, UTF8Class
|
||||
|
||||
|
||||
class FilterSyntaxTests(TestCase):
|
||||
class FilterSyntaxTests(SimpleTestCase):
|
||||
|
||||
@setup({'filter-syntax01': '{{ var|upper }}'})
|
||||
def test_filter_syntax01(self):
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class FilterTagTests(TestCase):
|
||||
class FilterTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'filter01': '{% filter upper %}{% endfilter %}'})
|
||||
def test_filter01(self):
|
||||
|
|
|
@ -2,13 +2,13 @@ import warnings
|
|||
|
||||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class FirstOfTagTests(TestCase):
|
||||
class FirstOfTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'firstof01': '{% firstof a b c %}'})
|
||||
def test_firstof01(self):
|
||||
|
|
|
@ -2,13 +2,13 @@ import warnings
|
|||
|
||||
from django.conf import settings
|
||||
from django.template.base import TemplateSyntaxError
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class ForTagTests(TestCase):
|
||||
class ForTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'for-tag01': '{% for val in values %}{{ val }}{% endfor %}'})
|
||||
def test_for_tag01(self):
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class I18nTagTests(TestCase):
|
||||
class I18nTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'i18n01': '{% load i18n %}{% trans \'xxxyyyxxx\' %}'})
|
||||
def test_i18n01(self):
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup, TestObj
|
||||
|
||||
|
||||
class IfTagTests(TestCase):
|
||||
class IfTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'if-tag01': '{% if foo %}yes{% else %}no{% endif %}'})
|
||||
def test_if_tag01(self):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class IfChangedTagTests(TestCase):
|
||||
class IfChangedTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'ifchanged01': '{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}'})
|
||||
def test_ifchanged01(self):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class IfEqualTagTests(TestCase):
|
||||
class IfEqualTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'ifequal01': '{% ifequal a b %}yes{% endifequal %}'})
|
||||
def test_ifequal01(self):
|
||||
|
@ -194,7 +194,7 @@ class IfEqualTagTests(TestCase):
|
|||
self.assertEqual(output, 'x')
|
||||
|
||||
|
||||
class IfNotEqualTagTests(TestCase):
|
||||
class IfNotEqualTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'ifnotequal01': '{% ifnotequal a b %}yes{% endifnotequal %}'})
|
||||
def test_ifnotequal01(self):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf import settings
|
||||
from django.template.base import Context, TemplateDoesNotExist, TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .test_basic import basic_templates
|
||||
from .utils import render, setup
|
||||
|
@ -13,7 +13,7 @@ include_fail_templates = {
|
|||
}
|
||||
|
||||
|
||||
class IncludeTagTests(TestCase):
|
||||
class IncludeTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'include01': '{% include "basic-syntax01" %}'}, basic_templates)
|
||||
def test_include01(self):
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class InvalidStringTests(TestCase):
|
||||
class InvalidStringTests(SimpleTestCase):
|
||||
|
||||
@setup({'invalidstr01': '{{ var|default:"Foo" }}'})
|
||||
def test_invalidstr01(self):
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class ListIndexTests(TestCase):
|
||||
class ListIndexTests(SimpleTestCase):
|
||||
|
||||
@setup({'list-index01': '{{ var.1 }}'})
|
||||
def test_list_index01(self):
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class LoadTagTests(TestCase):
|
||||
class LoadTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'load01': '{% load testtags subpackage.echo %}{% echo test %} {% echo2 "test" %}'})
|
||||
def test_load01(self):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class LoremTagTests(TestCase):
|
||||
class LoremTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'lorem1': '{% lorem 3 w %}'})
|
||||
def test_lorem1(self):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
@ -13,7 +13,7 @@ gentlemen.
|
|||
"""
|
||||
|
||||
|
||||
class MultilineTests(TestCase):
|
||||
class MultilineTests(SimpleTestCase):
|
||||
|
||||
@setup({'multiline01': multiline_string})
|
||||
def test_multiline01(self):
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class NamedEndblockTests(TestCase):
|
||||
class NamedEndblockTests(SimpleTestCase):
|
||||
|
||||
@setup({'namedendblocks01': '1{% block first %}_{% block second %}'
|
||||
'2{% endblock second %}_{% endblock first %}3'})
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
from datetime import datetime
|
||||
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils.formats import date_format
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class NowTagTests(TestCase):
|
||||
class NowTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'now01': '{% now "j n Y" %}'})
|
||||
def test_now01(self):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from unittest import skipIf
|
||||
|
||||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
@ -12,7 +12,7 @@ except ImportError:
|
|||
|
||||
|
||||
@skipIf(numpy is False, "Numpy must be installed to run these tests.")
|
||||
class NumpyTests(TestCase):
|
||||
class NumpyTests(SimpleTestCase):
|
||||
|
||||
@setup({'numpy-array-index01': '{{ var.1 }}'})
|
||||
def test_numpy_array_index01(self):
|
||||
|
|
|
@ -2,12 +2,12 @@ from datetime import date
|
|||
|
||||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class RegroupTagTests(TestCase):
|
||||
class RegroupTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'regroup01': ''
|
||||
'{% regroup data by bar as grouped %}'
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import setup
|
||||
|
||||
|
||||
class SetupTests(TestCase):
|
||||
class SetupTests(SimpleTestCase):
|
||||
|
||||
def test_setup(self):
|
||||
"""
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class SimpleTagTests(TestCase):
|
||||
class SimpleTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'simpletag-renamed01': '{% load custom %}{% minusone 7 %}'})
|
||||
def test_simpletag_renamed01(self):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class SpacelessTagTests(TestCase):
|
||||
class SpacelessTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'spaceless01': "{% spaceless %} <b> <i> text </i> </b> {% endspaceless %}"})
|
||||
def test_spaceless01(self):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
import warnings
|
||||
|
||||
from django.test import override_settings, TestCase
|
||||
from django.test import override_settings, SimpleTestCase
|
||||
from django.utils._os import upath
|
||||
from django.utils.deprecation import RemovedInDjango19Warning
|
||||
|
||||
|
@ -13,7 +13,7 @@ root = os.path.abspath(os.path.join(cwd, ".."))
|
|||
|
||||
|
||||
@override_settings(ALLOWED_INCLUDE_ROOTS=(root))
|
||||
class SsiTagTests(TestCase):
|
||||
class SsiTagTests(SimpleTestCase):
|
||||
|
||||
# Test normal behavior
|
||||
@setup({'ssi01': '{%% ssi "%s" %%}' % os.path.join(
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
from django.conf import settings
|
||||
from django.test import override_settings, TestCase
|
||||
from django.test import override_settings, SimpleTestCase
|
||||
from django.utils.six.moves.urllib.parse import urljoin
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
@override_settings(MEDIA_URL="/media/", STATIC_URL="/static/")
|
||||
class StaticTagTests(TestCase):
|
||||
class StaticTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'static-prefixtag01': '{% load static %}{% get_static_prefix %}'})
|
||||
def test_static_prefixtag01(self):
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class TemplateTagTests(TestCase):
|
||||
class TemplateTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'templatetag01': '{% templatetag openblock %}'})
|
||||
def test_templatetag01(self):
|
||||
|
|
|
@ -4,14 +4,14 @@ import warnings
|
|||
from django.core.urlresolvers import NoReverseMatch
|
||||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import override_settings, TestCase
|
||||
from django.test import override_settings, SimpleTestCase
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF='template_tests.urls')
|
||||
class UrlTagTests(TestCase):
|
||||
class UrlTagTests(SimpleTestCase):
|
||||
|
||||
# Successes
|
||||
@setup({'url01': '{% url "template_tests.views.client" client.id %}'})
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class VerbatimTagTests(TestCase):
|
||||
class VerbatimTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'verbatim-tag01': '{% verbatim %}{{bare }}{% endverbatim %}'})
|
||||
def test_verbatim_tag01(self):
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
from django.template.base import TemplateSyntaxError
|
||||
from django.template.loader import get_template
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils import six
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class WidthRatioTagTests(TestCase):
|
||||
class WidthRatioTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'widthratio01': '{% widthratio a b 0 %}'})
|
||||
def test_widthratio01(self):
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.conf import settings
|
||||
from django.template.base import TemplateSyntaxError
|
||||
from django.test import TestCase
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .utils import render, setup
|
||||
|
||||
|
||||
class WithTagTests(TestCase):
|
||||
class WithTagTests(SimpleTestCase):
|
||||
|
||||
@setup({'with01': '{% with key=dict.key %}{{ key }}{% endwith %}'})
|
||||
def test_with01(self):
|
||||
|
|
|
@ -24,7 +24,7 @@ from django.template import TemplateDoesNotExist, Context
|
|||
from django.template.loaders.eggs import Loader as EggLoader
|
||||
from django.template.engine import Engine
|
||||
from django.template import loader
|
||||
from django.test import TestCase, override_settings
|
||||
from django.test import SimpleTestCase, override_settings
|
||||
from django.test.utils import IgnorePendingDeprecationWarningsMixin
|
||||
from django.utils import six
|
||||
from django.utils._os import upath
|
||||
|
@ -52,7 +52,7 @@ def create_egg(name, resources):
|
|||
|
||||
|
||||
@unittest.skipUnless(pkg_resources, 'setuptools is not installed')
|
||||
class EggLoaderTest(TestCase):
|
||||
class EggLoaderTest(SimpleTestCase):
|
||||
def setUp(self):
|
||||
# Defined here b/c at module scope we may not have pkg_resources
|
||||
class MockProvider(pkg_resources.NullProvider):
|
||||
|
@ -116,7 +116,7 @@ class EggLoaderTest(TestCase):
|
|||
)),
|
||||
)
|
||||
)
|
||||
class CachedLoader(TestCase):
|
||||
class CachedLoader(SimpleTestCase):
|
||||
def test_templatedir_caching(self):
|
||||
"Check that the template directories form part of the template cache key. Refs #13573"
|
||||
# Retrieve a template specifying a template directory to check
|
||||
|
@ -148,7 +148,7 @@ class CachedLoader(TestCase):
|
|||
os.path.join(os.path.dirname(upath(__file__)), 'templates'),
|
||||
)
|
||||
)
|
||||
class RenderToStringTest(TestCase):
|
||||
class RenderToStringTest(SimpleTestCase):
|
||||
def test_basic(self):
|
||||
self.assertEqual(loader.render_to_string('test_context.html'), 'obj:\n')
|
||||
|
||||
|
@ -215,7 +215,7 @@ class TemplateDirsOverrideTest(IgnorePendingDeprecationWarningsMixin, unittest.T
|
|||
)),
|
||||
)
|
||||
)
|
||||
class PriorityCacheLoader(TestCase):
|
||||
class PriorityCacheLoader(SimpleTestCase):
|
||||
def test_basic(self):
|
||||
"""
|
||||
Check that the order of template loader works. Refs #21460.
|
||||
|
@ -228,7 +228,7 @@ class PriorityCacheLoader(TestCase):
|
|||
TEMPLATE_LOADERS=('django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',),
|
||||
)
|
||||
class PriorityLoader(TestCase):
|
||||
class PriorityLoader(SimpleTestCase):
|
||||
def test_basic(self):
|
||||
"""
|
||||
Check that the order of template loader works. Refs #21460.
|
||||
|
|
|
@ -5,7 +5,7 @@ import pickle
|
|||
import time
|
||||
from datetime import datetime
|
||||
|
||||
from django.test import RequestFactory, TestCase
|
||||
from django.test import RequestFactory, SimpleTestCase
|
||||
from django.conf import settings
|
||||
from django.template import Template, Context
|
||||
from django.template.response import (TemplateResponse, SimpleTemplateResponse,
|
||||
|
@ -25,7 +25,7 @@ class CustomURLConfMiddleware(object):
|
|||
request.urlconf = 'template_tests.alternate_urls'
|
||||
|
||||
|
||||
class SimpleTemplateResponseTest(TestCase):
|
||||
class SimpleTemplateResponseTest(SimpleTestCase):
|
||||
|
||||
def _response(self, template='foo', *args, **kwargs):
|
||||
return SimpleTemplateResponse(Template(template), *args, **kwargs)
|
||||
|
@ -210,7 +210,7 @@ class SimpleTemplateResponseTest(TestCase):
|
|||
TEMPLATE_CONTEXT_PROCESSORS=[test_processor_name],
|
||||
TEMPLATE_DIRS=(os.path.join(os.path.dirname(upath(__file__)), 'templates')),
|
||||
)
|
||||
class TemplateResponseTest(TestCase):
|
||||
class TemplateResponseTest(SimpleTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.factory = RequestFactory()
|
||||
|
@ -311,7 +311,7 @@ class TemplateResponseTest(TestCase):
|
|||
],
|
||||
ROOT_URLCONF='template_tests.urls',
|
||||
)
|
||||
class CustomURLConfTest(TestCase):
|
||||
class CustomURLConfTest(SimpleTestCase):
|
||||
|
||||
def test_custom_urlconf(self):
|
||||
response = self.client.get('/template_response_view/')
|
||||
|
@ -327,7 +327,7 @@ class CustomURLConfTest(TestCase):
|
|||
],
|
||||
ROOT_URLCONF='template_tests.alternate_urls',
|
||||
)
|
||||
class CacheMiddlewareTest(TestCase):
|
||||
class CacheMiddlewareTest(SimpleTestCase):
|
||||
|
||||
def test_middleware_caching(self):
|
||||
response = self.client.get('/template_response_view/')
|
||||
|
|
|
@ -13,7 +13,7 @@ from django.core import urlresolvers
|
|||
from django.template import loader, Context, RequestContext, Template, TemplateSyntaxError
|
||||
from django.template.engine import Engine
|
||||
from django.template.loaders import app_directories, filesystem
|
||||
from django.test import RequestFactory, TestCase
|
||||
from django.test import RequestFactory, SimpleTestCase
|
||||
from django.test.utils import override_settings, extend_sys_path
|
||||
from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning
|
||||
from django.utils._os import upath
|
||||
|
@ -28,7 +28,7 @@ class ContextStackException(Exception):
|
|||
pass
|
||||
|
||||
|
||||
class TemplateLoaderTests(TestCase):
|
||||
class TemplateLoaderTests(SimpleTestCase):
|
||||
|
||||
def test_loaders_security(self):
|
||||
ad_loader = app_directories.Loader(Engine.get_default())
|
||||
|
@ -253,7 +253,7 @@ class TemplateLoaderTests(TestCase):
|
|||
)
|
||||
|
||||
|
||||
class TemplateRegressionTests(TestCase):
|
||||
class TemplateRegressionTests(SimpleTestCase):
|
||||
|
||||
def test_token_smart_split(self):
|
||||
# Regression test for #7027
|
||||
|
@ -395,7 +395,7 @@ class TemplateRegressionTests(TestCase):
|
|||
|
||||
# Set ALLOWED_INCLUDE_ROOTS so that ssi works.
|
||||
@override_settings(TEMPLATE_DEBUG=False, ROOT_URLCONF='template_tests.urls')
|
||||
class TemplateTests(TestCase):
|
||||
class TemplateTests(SimpleTestCase):
|
||||
|
||||
@register_test_tags
|
||||
def test_templates(self):
|
||||
|
@ -501,7 +501,7 @@ class TemplateTests(TestCase):
|
|||
return output
|
||||
|
||||
|
||||
class TemplateTagLoading(TestCase):
|
||||
class TemplateTagLoading(SimpleTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.egg_dir = '%s/eggs' % os.path.dirname(upath(__file__))
|
||||
|
@ -585,7 +585,7 @@ class RequestContextTests(unittest.TestCase):
|
|||
)
|
||||
|
||||
|
||||
class SSITests(TestCase):
|
||||
class SSITests(SimpleTestCase):
|
||||
def setUp(self):
|
||||
self.this_dir = os.path.dirname(os.path.abspath(upath(__file__)))
|
||||
self.ssi_dir = os.path.join(self.this_dir, "templates", "first")
|
||||
|
|
Loading…
Reference in New Issue