summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2010-12-04 07:28:12 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2010-12-04 07:28:12 +0000
commit5bc0ec4ec4b7c888a291bc81b2edd72812231d96 (patch)
treebf3bec9ab44f1847ed2076167039e763011ea1cd /django
parent6770c3626271569da41053c1cfd37f7128f1457f (diff)
Removed all usages of deprecated TestCase methods (self.fail*). This removed most of the Warnings emitted (with -Wall) during the test suite.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/contrib/formtools/tests/__init__.py14
-rw-r--r--django/test/testcases.py10
2 files changed, 11 insertions, 13 deletions
diff --git a/django/contrib/formtools/tests/__init__.py b/django/contrib/formtools/tests/__init__.py
index 6aeeaf5a3d..b88f565d6b 100644
--- a/django/contrib/formtools/tests/__init__.py
+++ b/django/contrib/formtools/tests/__init__.py
@@ -1,14 +1,13 @@
import os
-from django import forms
-from django import http
+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.utils import unittest
-success_string = "Done was called!"
+success_string = "Done was called!"
class TestFormPreview(preview.FormPreview):
def get_context(self, request, form):
@@ -100,7 +99,7 @@ class PreviewTests(TestCase):
# show we previously saw first stage of the form.
self.test_data.update({'stage':2})
response = self.client.post('/test1/', self.test_data)
- self.failIfEqual(response.content, success_string)
+ self.assertNotEqual(response.content, success_string)
hash = self.preview.security_hash(None, TestForm(self.test_data))
self.test_data.update({'hash': hash})
response = self.client.post('/test1/', self.test_data)
@@ -134,7 +133,7 @@ class PreviewTests(TestCase):
# show we previously saw first stage of the form.
self.test_data.update({'stage':2})
response = self.client.post('/test1/', self.test_data)
- self.failIfEqual(response.content, success_string)
+ self.assertNotEqual(response.content, success_string)
hash = utils.security_hash(None, TestForm(self.test_data))
self.test_data.update({'hash': hash})
response = self.client.post('/test1/', self.test_data)
@@ -151,11 +150,11 @@ class PreviewTests(TestCase):
self.test_data.update({'stage':2})
response = self.client.post('/test2/', self.test_data)
self.assertEqual(response.status_code, 200)
- self.failIfEqual(response.content, success_string)
+ self.assertNotEqual(response.content, success_string)
hash = utils.security_hash(None, TestForm(self.test_data))
self.test_data.update({'hash': hash})
response = self.client.post('/test2/', self.test_data)
- self.failIfEqual(response.content, success_string)
+ self.assertNotEqual(response.content, success_string)
class SecurityHashTests(unittest.TestCase):
@@ -392,4 +391,3 @@ class WizardTests(TestCase):
"wizard_step": "1"}
wizard(DummyRequest(POST=data))
self.assertTrue(reached[0])
-
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 398ad774d8..a79a304547 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -355,7 +355,7 @@ class TransactionTestCase(ut2.TestCase):
if hasattr(response, 'redirect_chain'):
# The request was a followed redirect
- self.failUnless(len(response.redirect_chain) > 0,
+ self.assertTrue(len(response.redirect_chain) > 0,
msg_prefix + "Response didn't redirect as expected: Response"
" code was %d (expected %d)" %
(response.status_code, status_code))
@@ -469,7 +469,7 @@ class TransactionTestCase(ut2.TestCase):
if field:
if field in context[form].errors:
field_errors = context[form].errors[field]
- self.failUnless(err in field_errors,
+ self.assertTrue(err in field_errors,
msg_prefix + "The field '%s' on form '%s' in"
" context %d does not contain the error '%s'"
" (actual errors: %s)" %
@@ -484,7 +484,7 @@ class TransactionTestCase(ut2.TestCase):
(form, i, field))
else:
non_field_errors = context[form].non_field_errors()
- self.failUnless(err in non_field_errors,
+ self.assertTrue(err in non_field_errors,
msg_prefix + "The form '%s' in context %d does not"
" contain the non-field error '%s'"
" (actual errors: %s)" %
@@ -504,7 +504,7 @@ class TransactionTestCase(ut2.TestCase):
template_names = [t.name for t in response.templates]
if not template_names:
self.fail(msg_prefix + "No templates used to render the response")
- self.failUnless(template_name in template_names,
+ self.assertTrue(template_name in template_names,
msg_prefix + "Template '%s' was not a template used to render"
" the response. Actual template(s) used: %s" %
(template_name, u', '.join(template_names)))
@@ -518,7 +518,7 @@ class TransactionTestCase(ut2.TestCase):
msg_prefix += ": "
template_names = [t.name for t in response.templates]
- self.failIf(template_name in template_names,
+ self.assertFalse(template_name in template_names,
msg_prefix + "Template '%s' was used unexpectedly in rendering"
" the response" % template_name)