summaryrefslogtreecommitdiff
path: root/tests/admin_views
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-06-28 11:21:26 -0400
committerTim Graham <timograham@gmail.com>2016-07-01 09:58:56 -0400
commit567cfc1601a5f475eea12bc5de53b849fa5dadea (patch)
treec471ba1af748008e4fbe9faee8cf51d4dffcd263 /tests/admin_views
parent9c48e17480432b8723fcdcc262d8d62866e93a4f (diff)
[1.10.x] Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions. Backport of c9ae09addffb839403312131d4251e9d8b454508 from master
Diffstat (limited to 'tests/admin_views')
-rw-r--r--tests/admin_views/tests.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 589d7d9298..443c63081c 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -1224,10 +1224,7 @@ class CustomModelAdminTest(AdminViewBasicTestCase):
self.assertContains(response, 'Hello from a custom logout template')
def test_custom_admin_site_index_view_and_template(self):
- try:
- response = self.client.get(reverse('admin2:index'))
- except TypeError:
- self.fail('AdminSite.index_template should accept a list of template paths')
+ response = self.client.get(reverse('admin2:index'))
self.assertIsInstance(response, TemplateResponse)
self.assertTemplateUsed(response, 'custom_admin/index.html')
self.assertContains(response, 'Hello from a custom index template *bar*')
@@ -1264,12 +1261,7 @@ class CustomModelAdminTest(AdminViewBasicTestCase):
def test_pwd_change_custom_template(self):
self.client.force_login(self.superuser)
su = User.objects.get(username='super')
- try:
- response = self.client.get(
- reverse('admin4:auth_user_password_change', args=(su.pk,))
- )
- except TypeError:
- self.fail('ModelAdmin.change_user_password_template should accept a list of template paths')
+ response = self.client.get(reverse('admin4:auth_user_password_change', args=(su.pk,)))
self.assertEqual(response.status_code, 200)