Used the override_settings decorator in the tests of auth, flatpages, and formtools.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17851 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Aymeric Augustin
2012-03-31 16:03:09 +00:00
parent d552587244
commit 43f6f45c36
2 changed files with 15 additions and 24 deletions

View File

@@ -0,0 +1 @@
Not found.

View File

@@ -7,6 +7,7 @@ from django.conf import settings
from django.contrib.formtools import preview, utils from django.contrib.formtools import preview, utils
from django.contrib.formtools.wizard import FormWizard from django.contrib.formtools.wizard import FormWizard
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings
from django.utils import unittest from django.utils import unittest
from django.contrib.formtools.tests.wizard import * from django.contrib.formtools.tests.wizard import *
@@ -29,19 +30,12 @@ class TestFormPreview(preview.FormPreview):
def done(self, request, cleaned_data): def done(self, request, cleaned_data):
return http.HttpResponse(success_string) return http.HttpResponse(success_string)
@override_settings(
class FormToolsTestCase(TestCase): TEMPLATE_DIRS=(
def setUp(self): os.path.join(os.path.dirname(__file__), 'templates'),
# in the test runner use templates/tests/ to provide base.html ),
self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS )
settings.TEMPLATE_DIRS = list(settings.TEMPLATE_DIRS) + [ class PreviewTests(TestCase):
os.path.join(os.path.dirname(__file__), 'templates')]
def tearDown(self):
settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
class PreviewTests(FormToolsTestCase):
urls = 'django.contrib.formtools.tests.urls' urls = 'django.contrib.formtools.tests.urls'
def setUp(self): def setUp(self):
@@ -215,7 +209,13 @@ class DummyRequest(http.HttpRequest):
self._dont_enforce_csrf_checks = True self._dont_enforce_csrf_checks = True
class WizardTests(FormToolsTestCase): @override_settings(
SECRET_KEY="123",
TEMPLATE_DIRS=(
os.path.join(os.path.dirname(__file__), 'templates'),
),
)
class WizardTests(TestCase):
urls = 'django.contrib.formtools.tests.urls' urls = 'django.contrib.formtools.tests.urls'
input_re = re.compile('name="([^"]+)" value="([^"]+)"') input_re = re.compile('name="([^"]+)" value="([^"]+)"')
wizard_step_data = ( wizard_step_data = (
@@ -232,16 +232,6 @@ class WizardTests(FormToolsTestCase):
} }
) )
def setUp(self):
super(WizardTests, self).setUp()
# Use a known SECRET_KEY to make security_hash tests deterministic
self.old_SECRET_KEY = settings.SECRET_KEY
settings.SECRET_KEY = "123"
def tearDown(self):
super(WizardTests, self).tearDown()
settings.SECRET_KEY = self.old_SECRET_KEY
def test_step_starts_at_zero(self): def test_step_starts_at_zero(self):
""" """
step should be zero for the first form step should be zero for the first form