Fix video module tests related to transcript conversion.

This commit is contained in:
Feanil Patel
2019-10-09 09:47:58 -04:00
parent 5f8e59ccc8
commit 5ef86e2c3c
3 changed files with 5 additions and 5 deletions

View File

@@ -826,7 +826,7 @@ class VideoExportTestCase(VideoBlockTestBase):
"""
self.descriptor.transcripts = None
xml = self.descriptor.definition_to_xml(self.file_system)
expected = '<video url_name="SampleProblem"/>\n'
expected = b'<video url_name="SampleProblem"/>\n'
self.assertEquals(expected, etree.tostring(xml, pretty_print=True))
@patch('xmodule.video_module.video_module.edxval_api', None)

View File

@@ -185,7 +185,7 @@ def get_transcripts_from_youtube(youtube_id, settings, i18n, youtube_transcript_
raise GetTranscriptsFromYouTubeException(msg)
sub_starts, sub_ends, sub_texts = [], [], []
xmltree = etree.fromstring(data.content.encode('utf-8'), parser=utf8_parser)
xmltree = etree.fromstring(data.content, parser=utf8_parser)
for element in xmltree:
if element.tag == "text":
start = float(element.get("start"))
@@ -812,11 +812,11 @@ class VideoTranscriptsMixin(object):
log.debug("No subtitles for 'en' language")
raise ValueError
data = Transcript.asset(self.location, transcript_name, lang).data
data = Transcript.asset(self.location, transcript_name, lang).data.decode('utf-8')
filename = u'{}.{}'.format(transcript_name, transcript_format)
content = Transcript.convert(data, 'sjson', transcript_format)
else:
data = Transcript.asset(self.location, None, None, other_lang[lang]).data
data = Transcript.asset(self.location, None, None, other_lang[lang]).data.decode('utf-8')
filename = u'{}.{}'.format(os.path.splitext(other_lang[lang])[0], transcript_format)
content = Transcript.convert(data, 'srt', transcript_format)

View File

@@ -481,7 +481,7 @@ class VideoBlock(
'There is no transcript file associated with the {lang} language.',
'There are no transcript files associated with the {lang} languages.',
len(no_transcript_lang)
).format(lang=', '.join(no_transcript_lang))
).format(lang=', '.join(sorted(no_transcript_lang)))
)
)
return validation