From 167d98528a2f38e370507ffe4f352b3406f5c5e1 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Tue, 3 Apr 2018 07:11:35 -0700 Subject: [PATCH] Refs #27728 -- Fixed BytesWarning in admin_views tests. --- tests/admin_views/test_templatetags.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/admin_views/test_templatetags.py b/tests/admin_views/test_templatetags.py index 4f33bbd7244..41bb8c37eb2 100644 --- a/tests/admin_views/test_templatetags.py +++ b/tests/admin_views/test_templatetags.py @@ -43,11 +43,10 @@ class AdminTemplateTagsTest(AdminViewBasicTestCase): response.render() self.assertIs(response.context_data['show_publish'], True) self.assertIs(response.context_data['extra'], True) - content = str(response.content) - self.assertIn('name="_save"', content) - self.assertIn('name="_publish"', content) - self.assertIn('override-change_form_object_tools', content) - self.assertIn('override-prepopulated_fields_js', content) + self.assertContains(response, 'name="_save"') + self.assertContains(response, 'name="_publish"') + self.assertContains(response, 'override-change_form_object_tools') + self.assertContains(response, 'override-prepopulated_fields_js') def test_override_change_list_template_tags(self): """ @@ -62,13 +61,12 @@ class AdminTemplateTagsTest(AdminViewBasicTestCase): admin.search_fields = ('title', 'content') response = admin.changelist_view(request) response.render() - content = str(response.content) - self.assertIn('override-actions', content) - self.assertIn('override-change_list_object_tools', content) - self.assertIn('override-change_list_results', content) - self.assertIn('override-date_hierarchy', content) - self.assertIn('override-pagination', content) - self.assertIn('override-search_form', content) + self.assertContains(response, 'override-actions') + self.assertContains(response, 'override-change_list_object_tools') + self.assertContains(response, 'override-change_list_results') + self.assertContains(response, 'override-date_hierarchy') + self.assertContains(response, 'override-pagination') + self.assertContains(response, 'override-search_form') class DateHierarchyTests(TestCase):