From 0ff62e766e9b594856da671519c43d73e60c6980 Mon Sep 17 00:00:00 2001 From: Qubad786 Date: Thu, 9 Mar 2017 21:30:05 +0500 Subject: [PATCH] prioritize youtube transcripts over html5 ones --- .../views/tests/test_transcripts.py | 113 +++++++++++++----- .../xmodule/video_module/transcripts_utils.py | 5 +- 2 files changed, 87 insertions(+), 31 deletions(-) diff --git a/cms/djangoapps/contentstore/views/tests/test_transcripts.py b/cms/djangoapps/contentstore/views/tests/test_transcripts.py index 5b9b406ecc..fc120638b8 100644 --- a/cms/djangoapps/contentstore/views/tests/test_transcripts.py +++ b/cms/djangoapps/contentstore/views/tests/test_transcripts.py @@ -40,6 +40,20 @@ class BaseTranscripts(CourseTestCase): except NotFoundError: pass + def save_subs_to_store(self, subs, subs_id): + """ + Save transcripts into `StaticContent`. + """ + filedata = json.dumps(subs, indent=2) + mime_type = 'application/json' + filename = 'subs_{0}.srt.sjson'.format(subs_id) + + content_location = StaticContent.compute_location(self.course.id, filename) + content = StaticContent(content_location, filename, mime_type, filedata) + contentstore().save(content) + del_cached_content(content_location) + return content_location + def setUp(self): """Create initial data.""" super(BaseTranscripts, self).setUp() @@ -82,8 +96,9 @@ class BaseTranscripts(CourseTestCase): class TestUploadTranscripts(BaseTranscripts): - """Tests for '/transcripts/upload' url.""" - + """ + Tests for '/transcripts/upload' url. + """ def setUp(self): """Create initial data.""" super(TestUploadTranscripts, self).setUp() @@ -347,20 +362,9 @@ class TestUploadTranscripts(BaseTranscripts): class TestDownloadTranscripts(BaseTranscripts): - """Tests for '/transcripts/download' url.""" - - def save_subs_to_store(self, subs, subs_id): - """Save transcripts into `StaticContent`.""" - filedata = json.dumps(subs, indent=2) - mime_type = 'application/json' - filename = 'subs_{0}.srt.sjson'.format(subs_id) - - content_location = StaticContent.compute_location(self.course.id, filename) - content = StaticContent(content_location, filename, mime_type, filedata) - contentstore().save(content) - del_cached_content(content_location) - return content_location - + """ + Tests for '/transcripts/download' url. + """ def test_success_download_youtube(self): self.item.data = '