From 118faa0893957bff0ac34765fc9a66c586c4a932 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Wed, 10 Apr 2013 10:16:15 +0200 Subject: [PATCH] Made usage of assertTemplateUsed in admin_views tests Thanks Baptiste Mispelon for the suggestion. --- tests/admin_views/tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 564e6104d7..e0000ff6b5 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -647,7 +647,7 @@ class AdminViewFormUrlTest(TestCase): os.path.join(os.path.dirname(upath(__file__)), 'templates'),) with self.settings(TEMPLATE_DIRS=template_dirs): response = self.client.get("/test_admin/admin/admin_views/color2/") - self.assertTrue('custom_filter_template.html' in [t.name for t in response.templates]) + self.assertTemplateUsed(response, 'custom_filter_template.html') @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @@ -3982,7 +3982,7 @@ class AdminViewLogoutTest(TestCase): def test_client_logout_url_can_be_used_to_login(self): response = self.client.get('/test_admin/admin/logout/') self.assertEqual(response.status_code, 200) - self.assertEqual(response.template_name, 'registration/logged_out.html') + self.assertTemplateUsed(response, 'registration/logged_out.html') self.assertEqual(response.request['PATH_INFO'], '/test_admin/admin/logout/') # we are now logged out @@ -3992,7 +3992,7 @@ class AdminViewLogoutTest(TestCase): # follow the redirect and test results. response = self.client.get('/test_admin/admin/logout/', follow=True) self.assertEqual(response.status_code, 200) - self.assertEqual(response.template_name, 'admin/login.html') + self.assertTemplateUsed(response, 'admin/login.html') self.assertEqual(response.request['PATH_INFO'], '/test_admin/admin/') self.assertContains(response, '')