Updated tests to use the TEMPLATES setting.
This commit is contained in:
@@ -44,15 +44,15 @@ How to use ``FormPreview``
|
|||||||
* Add ``'formtools'`` to your
|
* Add ``'formtools'`` to your
|
||||||
:setting:`INSTALLED_APPS` setting.
|
: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).
|
``app_directories`` template loader (which is the case by default).
|
||||||
|
|
||||||
See the :ref:`template loader docs <template-loaders>` for more.
|
See the :ref:`template loader docs <template-loaders>` for more.
|
||||||
|
|
||||||
* Otherwise, determine the full filesystem path to the
|
* Otherwise, determine the full filesystem path to the
|
||||||
:file:`formtools/templates` directory, and add that
|
:file:`formtools/templates` directory and add that directory to your
|
||||||
directory to your :setting:`TEMPLATE_DIRS` setting.
|
:setting:`DIRS <TEMPLATES-DIRS>` option in the :setting:`TEMPLATES`
|
||||||
|
setting.
|
||||||
|
|
||||||
2. Create a :class:`~FormPreview` subclass that
|
2. Create a :class:`~FormPreview` subclass that
|
||||||
overrides the ``done()`` method::
|
overrides the ``done()`` method::
|
||||||
|
|||||||
@@ -33,5 +33,10 @@ MIDDLEWARE_CLASSES = (
|
|||||||
|
|
||||||
SITE_ID = 1
|
SITE_ID = 1
|
||||||
|
|
||||||
|
TEMPLATES = [{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'APP_DIRS': True,
|
||||||
|
}]
|
||||||
|
|
||||||
MEDIA_ROOT = 'media'
|
MEDIA_ROOT = 'media'
|
||||||
STATIC_ROOT = 'static'
|
STATIC_ROOT = 'static'
|
||||||
|
|||||||
@@ -35,9 +35,11 @@ class TestFormPreview(preview.FormPreview):
|
|||||||
|
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
TEMPLATE_DIRS=(
|
TEMPLATES=[{
|
||||||
os.path.join(os.path.dirname(upath(__file__)), 'templates'),
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
),
|
'DIRS': [os.path.join(os.path.dirname(upath(__file__)), 'templates')],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
}],
|
||||||
ROOT_URLCONF='tests.urls',
|
ROOT_URLCONF='tests.urls',
|
||||||
)
|
)
|
||||||
class PreviewTests(TestCase):
|
class PreviewTests(TestCase):
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import os
|
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
from django.test.client import RequestFactory
|
from django.test.client import RequestFactory
|
||||||
from django.conf import settings
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.utils._os import upath
|
from django.utils._os import upath
|
||||||
|
|
||||||
@@ -332,11 +330,8 @@ class WizardTestKwargs(TestCase):
|
|||||||
self.wizard_step_data[0]['form1-user'] = self.testuser.pk
|
self.wizard_step_data[0]['form1-user'] = self.testuser.pk
|
||||||
|
|
||||||
def test_template(self):
|
def test_template(self):
|
||||||
templates = os.path.join(os.path.dirname(THIS_FILE), 'templates')
|
response = self.client.get(self.wizard_url)
|
||||||
with self.settings(
|
self.assertTemplateUsed(response, 'other_wizard_form.html')
|
||||||
TEMPLATE_DIRS=list(settings.TEMPLATE_DIRS) + [templates]):
|
|
||||||
response = self.client.get(self.wizard_url)
|
|
||||||
self.assertTemplateUsed(response, 'other_wizard_form.html')
|
|
||||||
|
|
||||||
|
|
||||||
class WizardTestGenericViewInterface(TestCase):
|
class WizardTestGenericViewInterface(TestCase):
|
||||||
|
|||||||
Reference in New Issue
Block a user