1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

[1.2.X] Removed all usages of deprecated TestCase methods (self.fail*). This removed most of the Warnings emitted (with -Wall) during the test suite. Backport of [14803].

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14805 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor
2010-12-04 07:49:31 +00:00
parent 5a792ec4cc
commit cc48f66f73
27 changed files with 403 additions and 388 deletions

View File

@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.conf import settings
from django.http import HttpRequest
from django.middleware.common import CommonMiddleware
from django.conf import settings
from django.test import TestCase
class CommonMiddlewareTest(TestCase):
def setUp(self):
@@ -74,7 +75,7 @@ class CommonMiddlewareTest(TestCase):
try:
CommonMiddleware().process_request(request)
except RuntimeError, e:
self.failUnless('end in a slash' in str(e))
self.assertTrue('end in a slash' in str(e))
settings.DEBUG = False
def test_append_slash_disabled(self):
@@ -125,7 +126,7 @@ class CommonMiddlewareTest(TestCase):
self.assertEquals(r.status_code, 301)
self.assertEquals(r['Location'],
'http://www.testserver/middleware/slash/')
# The following tests examine expected behavior given a custom urlconf that
# overrides the default one through the request object.
@@ -165,7 +166,7 @@ class CommonMiddlewareTest(TestCase):
request = self._get_request('customurlconf/slash')
request.urlconf = 'regressiontests.middleware.extra_urls'
r = CommonMiddleware().process_request(request)
self.failIf(r is None,
self.assertFalse(r is None,
"CommonMiddlware failed to return APPEND_SLASH redirect using request.urlconf")
self.assertEquals(r.status_code, 301)
self.assertEquals(r['Location'], 'http://testserver/middleware/customurlconf/slash/')
@@ -188,7 +189,7 @@ class CommonMiddlewareTest(TestCase):
try:
CommonMiddleware().process_request(request)
except RuntimeError, e:
self.failUnless('end in a slash' in str(e))
self.assertTrue('end in a slash' in str(e))
settings.DEBUG = False
def test_append_slash_disabled_custom_urlconf(self):
@@ -209,7 +210,7 @@ class CommonMiddlewareTest(TestCase):
request = self._get_request('customurlconf/needsquoting#')
request.urlconf = 'regressiontests.middleware.extra_urls'
r = CommonMiddleware().process_request(request)
self.failIf(r is None,
self.assertFalse(r is None,
"CommonMiddlware failed to return APPEND_SLASH redirect using request.urlconf")
self.assertEquals(r.status_code, 301)
self.assertEquals(