Python 3: assertIn -> assertContains consistency

This commit is contained in:
Nimisha Asthagiri
2019-09-28 18:34:46 -04:00
parent d4832a65aa
commit beb95eb69c
15 changed files with 87 additions and 87 deletions

View File

@@ -88,7 +88,7 @@ class TestExportGit(CourseTestCase):
modulestore().update_item(self.course_module, self.user.id)
response = self.client.get('{}?action=push'.format(self.test_url))
self.assertIn('Export Failed:', response.content.decode('utf-8'))
self.assertContains(response, 'Export Failed:')
def test_exception_translation(self):
"""
@@ -107,7 +107,7 @@ class TestExportGit(CourseTestCase):
self.make_bare_repo_with_course('test_repo')
response = self.client.get('{}?action=push'.format(self.test_url))
self.assertIn('Export Succeeded', response.content.decode('utf-8'))
self.assertContains(response, 'Export Succeeded')
def test_repo_with_dots(self):
"""
@@ -115,7 +115,7 @@ class TestExportGit(CourseTestCase):
"""
self.make_bare_repo_with_course('test.repo')
response = self.client.get('{}?action=push'.format(self.test_url))
self.assertIn('Export Succeeded', response.content.decode('utf-8'))
self.assertContains(response, 'Export Succeeded')
def test_dirty_repo(self):
"""

View File

@@ -341,4 +341,4 @@ class UnitTestLibraries(CourseTestCase):
# Now extra_user should apear in the list:
response = self.client.get(manage_users_url)
self.assertEqual(response.status_code, 200)
self.assertIn(extra_user.username, response.content.decode('utf-8'))
self.assertContains(response, extra_user.username)

View File

@@ -325,10 +325,10 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)
self.assertRegexpMatches(response["Content-Type"], "^text/html(;.*)?$")
self.assertIn(_get_default_video_image_url(), response.content.decode('utf-8'))
self.assertContains(response, _get_default_video_image_url())
# Crude check for presence of data in returned HTML
for video in self.previous_uploads:
self.assertIn(video["edx_video_id"], response.content.decode('utf-8'))
self.assertContains(response, video["edx_video_id"])
self.assertNotContains(response, 'video_upload_pagination')
@override_waffle_flag(ENABLE_VIDEO_UPLOAD_PAGINATION, active=True)
@@ -338,7 +338,7 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
"""
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)
self.assertIn('video_upload_pagination', response.content.decode('utf-8'))
self.assertContains(response, 'video_upload_pagination')
def test_post_non_json(self):
response = self.client.post(self.url, {"files": []})

View File

@@ -289,7 +289,7 @@ class TestAnnouncementsViews(MaintenanceViewTestCase):
"""
url = reverse("maintenance:announcement_index")
response = self.client.get(url)
self.assertIn('<div class="announcement-container">', response.content.decode('utf-8'))
self.assertContains(response, '<div class="announcement-container">')
def test_create(self):
"""
@@ -308,7 +308,7 @@ class TestAnnouncementsViews(MaintenanceViewTestCase):
announcement.save()
url = reverse("maintenance:announcement_edit", kwargs={"pk": announcement.pk})
response = self.client.get(url)
self.assertIn('<div class="wrapper-form announcement-container">', response.content.decode('utf-8'))
self.assertContains(response, '<div class="wrapper-form announcement-container">')
self.client.post(url, {"content": "Test Edit Announcement", "active": True})
announcement = Announcement.objects.get(pk=announcement.pk)
self.assertEquals(announcement.content, "Test Edit Announcement")