Unit Tests for CachedLoader
This commit is contained in:
parent
8634634b1c
commit
a21ed181fe
|
@ -1,5 +1,6 @@
|
|||
from .test_routes import *
|
||||
from .test_tenants import *
|
||||
from .template_loader import *
|
||||
from .test_cache import *
|
||||
from .test_log import *
|
||||
from .test_routes import *
|
||||
from .test_tenants import *
|
||||
from .test_utils import *
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
from .test_cached_template_loader import CachedLoaderTests
|
|
@ -0,0 +1 @@
|
|||
Hello! (Django templates)
|
|
@ -0,0 +1,31 @@
|
|||
import os
|
||||
|
||||
from django.template.loader import get_template
|
||||
from django.test import SimpleTestCase, override_settings
|
||||
|
||||
|
||||
@override_settings(
|
||||
TEMPLATES=[
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [
|
||||
os.path.join(os.path.dirname(__file__), "templates")
|
||||
],
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.request',
|
||||
],
|
||||
'loaders': [
|
||||
('tenant_schemas.template_loaders.CachedLoader', (
|
||||
'tenant_schemas.template_loaders.FilesystemLoader',
|
||||
'django.template.loaders.filesystem.Loader'
|
||||
))
|
||||
]
|
||||
},
|
||||
}
|
||||
]
|
||||
)
|
||||
class CachedLoaderTests(SimpleTestCase):
|
||||
def test_get_template(self):
|
||||
template = get_template("hello.html")
|
||||
self.assertEqual(template.render(), "Hello! (Django templates)\n")
|
Loading…
Reference in New Issue