Updated tests to use the TEMPLATES setting.

This commit is contained in:
Tim Graham
2016-05-28 11:11:34 -04:00
parent e0244cff08
commit 0e5c0c0d65
4 changed files with 16 additions and 14 deletions

View File

@@ -44,15 +44,15 @@ How to use ``FormPreview``
* Add ``'formtools'`` to your
:setting:`INSTALLED_APPS` setting.
This will work if your :setting:`TEMPLATE_LOADERS` setting includes the
This will work if your :setting:`TEMPLATES` setting includes the
``app_directories`` template loader (which is the case by default).
See the :ref:`template loader docs <template-loaders>` for more.
* Otherwise, determine the full filesystem path to the
:file:`formtools/templates` directory, and add that
directory to your :setting:`TEMPLATE_DIRS` setting.
:file:`formtools/templates` directory and add that directory to your
:setting:`DIRS <TEMPLATES-DIRS>` option in the :setting:`TEMPLATES`
setting.
2. Create a :class:`~FormPreview` subclass that
overrides the ``done()`` method::

View File

@@ -33,5 +33,10 @@ MIDDLEWARE_CLASSES = (
SITE_ID = 1
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
}]
MEDIA_ROOT = 'media'
STATIC_ROOT = 'static'

View File

@@ -35,9 +35,11 @@ class TestFormPreview(preview.FormPreview):
@override_settings(
TEMPLATE_DIRS=(
os.path.join(os.path.dirname(upath(__file__)), 'templates'),
),
TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(os.path.dirname(upath(__file__)), 'templates')],
'APP_DIRS': True,
}],
ROOT_URLCONF='tests.urls',
)
class PreviewTests(TestCase):

View File

@@ -1,12 +1,10 @@
from __future__ import unicode_literals
import copy
import os
from django import forms
from django.test import TestCase, override_settings
from django.test.client import RequestFactory
from django.conf import settings
from django.contrib.auth.models import User
from django.utils._os import upath
@@ -332,11 +330,8 @@ class WizardTestKwargs(TestCase):
self.wizard_step_data[0]['form1-user'] = self.testuser.pk
def test_template(self):
templates = os.path.join(os.path.dirname(THIS_FILE), 'templates')
with self.settings(
TEMPLATE_DIRS=list(settings.TEMPLATE_DIRS) + [templates]):
response = self.client.get(self.wizard_url)
self.assertTemplateUsed(response, 'other_wizard_form.html')
response = self.client.get(self.wizard_url)
self.assertTemplateUsed(response, 'other_wizard_form.html')
class WizardTestGenericViewInterface(TestCase):