From 9bbc21ea8ccbcffb8e55ca51037bdaf0cf747a63 Mon Sep 17 00:00:00 2001 From: Nimisha Asthagiri Date: Sun, 29 Sep 2019 00:22:48 -0400 Subject: [PATCH] Python 3: multi-lined assertIn, assertNotIn -> assertContains, assertNotContains --- .../contentstore/tests/test_course_listing.py | 3 +- .../contentstore/tests/test_export_git.py | 10 +-- .../contentstore/views/tests/test_videos.py | 9 ++- lms/djangoapps/branding/tests/test_views.py | 2 +- .../bulk_enroll/tests/test_views.py | 17 ++-- .../certificates/tests/test_views.py | 15 ++-- .../certificates/tests/test_webview_views.py | 81 +++++-------------- .../courseware/tests/test_masquerade.py | 8 +- lms/djangoapps/courseware/tests/test_views.py | 19 +++-- .../dashboard/tests/test_sysadmin.py | 8 +- lms/djangoapps/instructor/tests/test_api.py | 8 +- .../instructor/tests/test_spoc_gradebook.py | 8 +- .../tests/views/test_instructor_dashboard.py | 2 +- .../tests/test_configuration_overrides.py | 26 +++--- .../shoppingcart/tests/test_views.py | 3 +- .../tests/test_fake_software_secure.py | 6 +- .../user_authn/views/tests/test_views.py | 3 +- .../tests/views/test_course_home.py | 7 +- .../tests/views/test_course_outline.py | 3 - .../tests/views/test_course_sock.py | 3 +- 20 files changed, 93 insertions(+), 148 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_course_listing.py b/cms/djangoapps/contentstore/tests/test_course_listing.py index 99dd9e92fe..0bdd81459d 100644 --- a/cms/djangoapps/contentstore/tests/test_course_listing.py +++ b/cms/djangoapps/contentstore/tests/test_course_listing.py @@ -93,8 +93,7 @@ class TestCourseListing(ModuleStoreTestCase): """ message = u"Are you staff on an existing {studio_name} course?".format(studio_name=settings.STUDIO_SHORT_NAME) response = self.client.get('/home') - self.assertEqual(response.status_code, 200) - self.assertIn(message, response.content.decode(response.charset)) + self.assertContains(response, message) def test_get_course_list(self): """ diff --git a/cms/djangoapps/contentstore/tests/test_export_git.py b/cms/djangoapps/contentstore/tests/test_export_git.py index a969968cac..8d11af6b12 100644 --- a/cms/djangoapps/contentstore/tests/test_export_git.py +++ b/cms/djangoapps/contentstore/tests/test_export_git.py @@ -65,19 +65,17 @@ class TestExportGit(CourseTestCase): if course hasn't set giturl. """ response = self.client.get(self.test_url) - self.assertEqual(200, response.status_code) - self.assertIn( + self.assertContains( + response, ('giturl must be defined in your ' 'course settings before you can export to git.'), - response.content.decode('utf-8') ) response = self.client.get('{}?action=push'.format(self.test_url)) - self.assertEqual(200, response.status_code) - self.assertIn( + self.assertContains( + response, ('giturl must be defined in your ' 'course settings before you can export to git.'), - response.content.decode('utf-8') ) def test_course_export_failures(self): diff --git a/cms/djangoapps/contentstore/views/tests/test_videos.py b/cms/djangoapps/contentstore/views/tests/test_videos.py index d4f6ac2d6c..a851aac47d 100644 --- a/cms/djangoapps/contentstore/views/tests/test_videos.py +++ b/cms/djangoapps/contentstore/views/tests/test_videos.py @@ -781,10 +781,11 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase): self.assertEqual(response.status_code, 200) # Verify that course video button is present in the response if videos transcript feature is enabled. - self.assertEqual( - '