summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2011-04-02 13:26:19 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2011-04-02 13:26:19 +0000
commit4749159d48c42c706cd14ab105179f29deab734d (patch)
tree00ed70a0cfa599f4e8c6e7f52b46a0d49e14e312
parent27efda5f5b0dca23c244e7a8cb2b11361bc6dc58 (diff)
Silenced a DeprecationWarning in formtools caused by testing the deprecated security_hash function
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15996 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/formtools/tests/__init__.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/django/contrib/formtools/tests/__init__.py b/django/contrib/formtools/tests/__init__.py
index f093ba79f9..b5037f428d 100644
--- a/django/contrib/formtools/tests/__init__.py
+++ b/django/contrib/formtools/tests/__init__.py
@@ -1,9 +1,11 @@
import os
+import warnings
from django import forms, http
from django.conf import settings
from django.contrib.formtools import preview, wizard, utils
from django.test import TestCase
+from django.test.utils import get_warnings_state, restore_warnings_state
from django.utils import unittest
@@ -32,12 +34,19 @@ class PreviewTests(TestCase):
urls = 'django.contrib.formtools.tests.urls'
def setUp(self):
+ self.save_warnings_state()
+ warnings.filterwarnings('ignore', category=DeprecationWarning,
+ module='django.contrib.formtools.utils')
+
# Create a FormPreview instance to share between tests
self.preview = preview.FormPreview(TestForm)
input_template = '<input type="hidden" name="%s" value="%s" />'
self.input = input_template % (self.preview.unused_name('stage'), "%d")
self.test_data = {'field1':u'foo', 'field1_':u'asdf'}
+ def tearDown(self):
+ self.restore_warnings_state()
+
def test_unused_name(self):
"""
Verifies name mangling to get uniue field name.
@@ -150,6 +159,13 @@ class PreviewTests(TestCase):
class SecurityHashTests(unittest.TestCase):
+ def setUp(self):
+ self._warnings_state = get_warnings_state()
+ warnings.filterwarnings('ignore', category=DeprecationWarning,
+ module='django.contrib.formtools.utils')
+
+ def tearDown(self):
+ restore_warnings_state(self._warnings_state)
def test_textfield_hash(self):
"""