From c5a30f8eb5291d3103fe5e8bd8c41c2b086a5a44 Mon Sep 17 00:00:00 2001 From: muhammad-ammar Date: Tue, 20 Mar 2018 16:16:36 +0500 Subject: [PATCH] update check_transcripts handler EDUCATOR-2129 --- .../views/tests/test_transcripts.py | 26 +++-- .../contentstore/views/transcripts_ajax.py | 106 +++++++++--------- 2 files changed, 67 insertions(+), 65 deletions(-) diff --git a/cms/djangoapps/contentstore/views/tests/test_transcripts.py b/cms/djangoapps/contentstore/views/tests/test_transcripts.py index 9d99c072d9..d9fffdb515 100644 --- a/cms/djangoapps/contentstore/views/tests/test_transcripts.py +++ b/cms/djangoapps/contentstore/views/tests/test_transcripts.py @@ -824,19 +824,21 @@ class TestCheckTranscripts(BaseTranscripts): self.assertEqual(resp.status_code, 400) self.assertEqual(json.loads(resp.content).get('status'), 'Transcripts are supported only for "video" modules.') - @ddt.data( - (True, 'found'), - (False, 'not_found') - ) - @ddt.unpack - @patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled') - @patch('xmodule.video_module.transcripts_utils.edxval_api.get_video_transcript_data', Mock(return_value=True)) - def test_command_for_fallback_transcript(self, feature_enabled, expected_command, video_transcript_feature): + @patch('xmodule.video_module.transcripts_utils.get_video_transcript_content') + def test_command_for_fallback_transcript(self, mock_get_video_transcript_content): """ - Verify the command if a transcript is not found in content-store but - its there in edx-val. + Verify the command if a transcript is there in edx-val. """ - video_transcript_feature.return_value = feature_enabled + mock_get_video_transcript_content.return_value = { + 'content': json.dumps({ + "start": [10], + "end": [100], + "text": ["Hi, welcome to Edx."], + }), + 'file_name': 'edx.sjson' + } + + # video_transcript_feature.return_value = feature_enabled self.item.data = textwrap.dedent("""