@@ -325,11 +325,11 @@ 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)
|
||||
self.assertIn(_get_default_video_image_url(), response.content.decode('utf-8'))
|
||||
# Crude check for presence of data in returned HTML
|
||||
for video in self.previous_uploads:
|
||||
self.assertIn(video["edx_video_id"], response.content)
|
||||
self.assertNotIn('video_upload_pagination', response.content)
|
||||
self.assertIn(video["edx_video_id"], response.content.decode('utf-8'))
|
||||
self.assertNotIn('video_upload_pagination', response.content.decode('utf-8'))
|
||||
|
||||
@override_waffle_flag(ENABLE_VIDEO_UPLOAD_PAGINATION, active=True)
|
||||
def test_get_html_paginated(self):
|
||||
@@ -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)
|
||||
self.assertIn('video_upload_pagination', response.content.decode('utf-8'))
|
||||
|
||||
def test_post_non_json(self):
|
||||
response = self.client.post(self.url, {"files": []})
|
||||
@@ -782,7 +782,7 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
|
||||
# Verify that course video button is present in the response if videos transcript feature is enabled.
|
||||
self.assertEqual(
|
||||
'<button class="button course-video-settings-button">' in response.content,
|
||||
'<button class="button course-video-settings-button">' in response.content.decode('utf-8'),
|
||||
is_video_transcript_enabled
|
||||
)
|
||||
|
||||
@@ -810,7 +810,7 @@ class VideoImageTestCase(VideoUploadTestBase, CourseTestCase):
|
||||
uploaded image url
|
||||
"""
|
||||
self.assertEqual(upload_response.status_code, 200)
|
||||
response = json.loads(upload_response.content)
|
||||
response = json.loads(upload_response.content.decode('utf-8'))
|
||||
val_image_url = get_course_video_image_url(course_id=course_id, edx_video_id=edx_video_id)
|
||||
self.assertEqual(response['image_url'], val_image_url)
|
||||
|
||||
@@ -1417,7 +1417,7 @@ class VideoUrlsCsvTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
response["Content-Disposition"],
|
||||
u"attachment; filename={course}_video_urls.csv".format(course=self.course.id.course)
|
||||
)
|
||||
response_reader = StringIO(response.content)
|
||||
response_reader = StringIO(response.content if six.PY2 else response.content.decode('utf-8'))
|
||||
reader = csv.DictReader(response_reader, dialect=csv.excel)
|
||||
self.assertEqual(
|
||||
reader.fieldnames,
|
||||
@@ -1430,7 +1430,8 @@ class VideoUrlsCsvTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
self.assertEqual(len(rows), len(self.previous_uploads))
|
||||
for i, row in enumerate(rows):
|
||||
response_video = {
|
||||
key.decode("utf-8"): value.decode("utf-8") for key, value in row.items()
|
||||
key.decode("utf-8") if six.PY2 else key: value.decode("utf-8") if six.PY2 else value
|
||||
for key, value in row.items()
|
||||
}
|
||||
# Videos should be returned by creation date descending
|
||||
original_video = self.previous_uploads[-(i + 1)]
|
||||
|
||||
@@ -412,7 +412,7 @@ def video_encodings_download(request, course_key_string):
|
||||
]
|
||||
)
|
||||
return {
|
||||
key.encode("utf-8"): value.encode("utf-8")
|
||||
key.encode("utf-8") if six.PY2 else key: value.encode("utf-8") if six.PY2 else value
|
||||
for key, value in ret.items()
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ def video_encodings_download(request, course_key_string):
|
||||
writer = csv.DictWriter(
|
||||
response,
|
||||
[
|
||||
col_name.encode("utf-8")
|
||||
col_name.encode("utf-8") if six.PY2 else col_name
|
||||
for col_name
|
||||
in [name_col, duration_col, added_col, video_id_col, status_col] + profile_cols
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user