summaryrefslogtreecommitdiff
path: root/tests/admin_views
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-06-28 11:21:26 -0400
committerGitHub <noreply@github.com>2016-06-28 11:21:26 -0400
commitc9ae09addffb839403312131d4251e9d8b454508 (patch)
tree74913fbe2e90d88e094f8594947ebf313ec5f12f /tests/admin_views
parentc1b6f554e405fe733e8d80f7e3d77c277810e707 (diff)
Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions.
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 421d2ce25b..f7427f7da0 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -1243,10 +1243,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*')
@@ -1283,12 +1280,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)