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
This commit is contained in:
Alex Gaynor 2010-12-04 07:28:12 +00:00
parent 6770c36262
commit 5bc0ec4ec4
30 changed files with 386 additions and 379 deletions

View file

@ -73,7 +73,7 @@ class ClientTest(TestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context['data'], '37')
self.assertEqual(response.templates[0].name, 'POST Template')
self.failUnless('Data received' in response.content)
self.assertTrue('Data received' in response.content)
def test_response_headers(self):
"Check the value of HTTP headers returned in a response"
@ -278,7 +278,7 @@ class ClientTest(TestCase):
# Log in
login = self.client.login(username='testclient', password='password')
self.failUnless(login, 'Could not log in')
self.assertTrue(login, 'Could not log in')
# Request a page that requires a login
response = self.client.get('/test_client/login_protected_view/')
@ -294,7 +294,7 @@ class ClientTest(TestCase):
# Log in
login = self.client.login(username='testclient', password='password')
self.failUnless(login, 'Could not log in')
self.assertTrue(login, 'Could not log in')
# Request a page that requires a login
response = self.client.get('/test_client/login_protected_method_view/')
@ -310,7 +310,7 @@ class ClientTest(TestCase):
# Log in
login = self.client.login(username='testclient', password='password')
self.failUnless(login, 'Could not log in')
self.assertTrue(login, 'Could not log in')
# Request a page that requires a login
response = self.client.get('/test_client/login_protected_view_custom_redirect/')
@ -321,13 +321,13 @@ class ClientTest(TestCase):
"Request a page that is protected with @login, but use bad credentials"
login = self.client.login(username='otheruser', password='nopassword')
self.failIf(login)
self.assertFalse(login)
def test_view_with_inactive_login(self):
"Request a page that is protected with @login, but use an inactive login"
login = self.client.login(username='inactive', password='password')
self.failIf(login)
self.assertFalse(login)
def test_logout(self):
"Request a logout after logging in"
@ -355,7 +355,7 @@ class ClientTest(TestCase):
# Log in
login = self.client.login(username='testclient', password='password')
self.failUnless(login, 'Could not log in')
self.assertTrue(login, 'Could not log in')
# Log in with wrong permissions. Should result in 302.
response = self.client.get('/test_client/permission_protected_view/')
@ -372,7 +372,7 @@ class ClientTest(TestCase):
# Log in
login = self.client.login(username='testclient', password='password')
self.failUnless(login, 'Could not log in')
self.assertTrue(login, 'Could not log in')
# Log in with wrong permissions. Should result in 302.
response = self.client.get('/test_client/permission_protected_method_view/')