diff --git a/cms/djangoapps/contentstore/views/tests/test_transcripts.py b/cms/djangoapps/contentstore/views/tests/test_transcripts.py index 05c1bebe45..89119f3f9d 100644 --- a/cms/djangoapps/contentstore/views/tests/test_transcripts.py +++ b/cms/djangoapps/contentstore/views/tests/test_transcripts.py @@ -581,7 +581,6 @@ class TestCheckTranscripts(BaseTranscripts): json.loads(resp.content), { u'status': u'Success', - u'subs': unicode(subs_id), u'youtube_local': False, u'is_youtube_mode': False, u'youtube_server': False, @@ -618,13 +617,14 @@ class TestCheckTranscripts(BaseTranscripts): 'mode': 'youtube', }] } + resp = self.client.get(link, {'data': json.dumps(data)}) + self.assertEqual(resp.status_code, 200) self.assertDictEqual( json.loads(resp.content), { u'status': u'Success', - u'subs': u'JMD_ifUUfsU', u'youtube_local': True, u'is_youtube_mode': True, u'youtube_server': False, @@ -676,7 +676,6 @@ class TestCheckTranscripts(BaseTranscripts): json.loads(resp.content), { u'status': u'Success', - u'subs': u'good_id_2', u'youtube_local': True, u'is_youtube_mode': True, u'youtube_server': True, @@ -816,7 +815,6 @@ class TestCheckTranscripts(BaseTranscripts): json.loads(response.content), { u'status': u'Success', - u'subs': u'', u'youtube_local': False, u'is_youtube_mode': False, u'youtube_server': False, @@ -827,63 +825,3 @@ class TestCheckTranscripts(BaseTranscripts): u'html5_equal': False, } ) - - -class TestSaveTranscripts(BaseTranscripts): - """ - Tests for '/transcripts/save' url. - """ - def assert_current_subs(self, expected_subs): - """ - Asserts the current subtitles set on the video module. - - Arguments: - expected_subs (String): Expected current subtitles for video. - """ - item = modulestore().get_item(self.video_usage_key) - self.assertEqual(item.sub, expected_subs) - - def test_prioritize_youtube_sub_on_save(self): - """ - Test that the '/transcripts/save' endpoint prioritises youtube subtitles over html5 ones - while deciding the current subs for video module. - """ - # Update video module to contain 1 youtube and 2 html5 sources. - youtube_id = str(uuid4()) - self.item.data = textwrap.dedent( - """ - - """.format(youtube_id=youtube_id) - ) - modulestore().update_item(self.item, self.user.id) - self.assert_current_subs(expected_subs='') - - # Save new subs in the content store. - subs = { - 'start': [100, 200, 240], - 'end': [200, 240, 380], - 'text': [ - 'subs #1', - 'subs #2', - 'subs #3' - ] - } - self.save_subs_to_store(subs, youtube_id) - - # Now, make request to /transcripts/save endpoint with new subs. - data = { - 'locator': unicode(self.video_usage_key), - 'metadata': { - 'sub': youtube_id - } - } - resp = self.client.get(reverse('save_transcripts'), {'data': json.dumps(data)}) - self.assertEqual(resp.status_code, 200) - self.assertEqual(json.loads(resp.content), {"status": "Success"}) - - # Now check item.sub, it should be same as youtube id because /transcripts/save prioritize - # youtube subs over html5 ones. - self.assert_current_subs(expected_subs=youtube_id) diff --git a/cms/djangoapps/contentstore/views/transcripts_ajax.py b/cms/djangoapps/contentstore/views/transcripts_ajax.py index 880b48bd0f..64e9b3d5f6 100644 --- a/cms/djangoapps/contentstore/views/transcripts_ajax.py +++ b/cms/djangoapps/contentstore/views/transcripts_ajax.py @@ -36,7 +36,6 @@ from xmodule.video_module.transcripts_utils import ( get_video_transcript_content, generate_subs_from_source, get_transcripts_from_youtube, - manage_video_subtitles_save, remove_subs_from_store, Transcript, TranscriptsRequestValidationException, @@ -58,7 +57,6 @@ __all__ = [ 'choose_transcripts', 'replace_transcripts', 'rename_transcripts', - 'save_transcripts', ] log = logging.getLogger(__name__) @@ -238,6 +236,7 @@ def check_transcripts(request): 'current_item_subs': None, 'status': 'Error', } + try: __, videos, item = _validate_transcripts_data(request) except TranscriptsRequestValidationException as e: @@ -247,7 +246,7 @@ def check_transcripts(request): try: get_transcript_from_val(edx_video_id=item.edx_video_id, lang=u'en') - command, subs_to_use = 'found', '' + command = 'found' except NotFoundError: filename = 'subs_{0}.srt.sjson'.format(item.sub) content_location = StaticContent.compute_location(item.location.course_key, filename) @@ -307,12 +306,9 @@ def check_transcripts(request): if len(html5_subs) == 2: # check html5 transcripts for equality transcripts_presence['html5_equal'] = json.loads(html5_subs[0]) == json.loads(html5_subs[1]) - command, subs_to_use = _transcripts_logic(transcripts_presence, videos) + command, __ = _transcripts_logic(transcripts_presence, videos) - transcripts_presence.update({ - 'command': command, - 'subs': subs_to_use, - }) + transcripts_presence.update({'command': command}) return JsonResponse(transcripts_presence) @@ -515,48 +511,6 @@ def rename_transcripts(request): return JsonResponse(response) -@login_required -def save_transcripts(request): - """ - Saves video module with updated values of fields. - - Returns: status `Success` or status `Error` and HTTP 400. - """ - response = {'status': 'Error'} - - data = json.loads(request.GET.get('data', '{}')) - if not data: - return error_response(response, 'Incoming video data is empty.') - - try: - item = _get_item(request, data) - except (InvalidKeyError, ItemNotFoundError): - return error_response(response, "Can't find item by locator.") - - metadata = data.get('metadata') - if metadata is not None: - new_sub = metadata.get('sub') - - for metadata_key, value in metadata.items(): - setattr(item, metadata_key, value) - - item.save_with_metadata(request.user) # item becomes updated with new values - - if new_sub: - manage_video_subtitles_save(item, request.user) - else: - # If `new_sub` is empty, it means that user explicitly does not want to use - # transcripts for current video ids and we remove all transcripts from storage. - current_subs = data.get('current_subs') - if current_subs is not None: - for sub in current_subs: - remove_subs_from_store(sub, item) - - response['status'] = 'Success' - - return JsonResponse(response) - - def _get_item(request, data): """ Obtains from 'data' the locator for an item. diff --git a/cms/static/js/spec/video/transcripts/editor_spec.js b/cms/static/js/spec/video/transcripts/editor_spec.js index 199369c33e..4d9fefbdaf 100644 --- a/cms/static/js/spec/video/transcripts/editor_spec.js +++ b/cms/static/js/spec/video/transcripts/editor_spec.js @@ -362,31 +362,6 @@ function($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCol }).getValue(); expect(youtubeValue).toEqual(''); }); - - it('Timed Transcript field is updated', function() { - Utils.Storage.set('sub', 'test_value'); - - transcripts.syncAdvancedTab(metadataCollection); - - var collection = metadataCollection.models, - subValue = collection[1].getValue(); - - expect(subValue).toEqual('test_value'); - }); - - it('Timed Transcript field is updated just once', function() { - Utils.Storage.set('sub', 'test_value'); - - var collection = metadataCollection.models, - subModel = collection[1]; - - spyOn(subModel, 'setValue'); - - transcripts.syncAdvancedTab(metadataCollection); - transcripts.syncAdvancedTab(metadataCollection); - transcripts.syncAdvancedTab(metadataCollection); - expect(subModel.setValue.calls.count()).toEqual(1); - }); }); }); }); diff --git a/cms/static/js/views/video/transcripts/editor.js b/cms/static/js/views/video/transcripts/editor.js index 8fe6659a18..aebb4427a9 100644 --- a/cms/static/js/views/video/transcripts/editor.js +++ b/cms/static/js/views/video/transcripts/editor.js @@ -75,7 +75,6 @@ function($, Backbone, _, Utils, MetadataView, MetadataCollection) { var result = [], getField = Utils.getField, component_locator = this.$el.closest('[data-locator]').data('locator'), - subs = getField(metadataCollection, 'sub'), values = {}, videoUrl, metadata, modifiedValues; @@ -89,37 +88,6 @@ function($, Backbone, _, Utils, MetadataView, MetadataCollection) { modifiedValues = metadataView.getModifiedMetadataValues(); - var isSubsModified = (function(values) { - var isSubsChanged = subs.hasChanged('value'); - - return Boolean( - isSubsChanged && - ( - // If the user changes the field, `values.sub` contains - // string value; - // If the user clicks `clear` button, the field contains - // null value. - // Otherwise, undefined. - _.isString(values.sub) || _.isNull(subs.getValue()) - ) - ); - }(modifiedValues)); - - // When we change value of `sub` field in the `Advanced`, - // we update data on backend. That provides possibility to remove - // transcripts. - if (isSubsModified) { - metadata = $.extend(true, {}, modifiedValues); - // Save module state - Utils.command('save', component_locator, null, { - metadata: metadata, - current_subs: _.pluck( - Utils.getVideoList(videoUrl.getDisplayValue()), - 'video' - ) - }); - } - // Get values from `Advanced` tab fields (`html5_sources`, // `youtube_id_1_0`) that should be synchronized. var html5Sources = getField(metadataCollection, 'html5_sources').getDisplayValue(); @@ -151,17 +119,6 @@ function($, Backbone, _, Utils, MetadataView, MetadataCollection) { // Synchronize other fields that has the same `field_name` property. Utils.syncCollections(metadataCollection, this.collection); - - if (isSubsModified) { - // When `sub` field is changed, clean Storage to avoid overwriting. - Utils.Storage.remove('sub'); - - // Trigger `change` event manually if `video_url` model - // isn't changed. - if (!videoUrl.hasChanged()) { - videoUrl.trigger('change'); - } - } }, /** @@ -177,8 +134,6 @@ function($, Backbone, _, Utils, MetadataView, MetadataCollection) { */ syncAdvancedTab: function(metadataCollection, metadataView) { var getField = Utils.getField, - subsValue = Utils.Storage.get('sub'), - subs = getField(metadataCollection, 'sub'), html5Sources, youtube, videoUrlValue, result; // if metadataCollection is not passed, just exit. @@ -234,14 +189,6 @@ function($, Backbone, _, Utils, MetadataView, MetadataCollection) { youtube.setValue(result); } - // If Utils.Storage contain some subtitles, update them. - if (_.isString(subsValue)) { - subs.setValue(subsValue); - // After updating should be removed, because it might overwrite - // subtitles added by user manually. - Utils.Storage.remove('sub'); - } - // Synchronize other fields that has the same `field_name` property. Utils.syncCollections(this.collection, metadataCollection); }, diff --git a/cms/static/js/views/video/transcripts/metadata_videolist.js b/cms/static/js/views/video/transcripts/metadata_videolist.js index b5d8e93e32..49cd863d12 100644 --- a/cms/static/js/views/video/transcripts/metadata_videolist.js +++ b/cms/static/js/views/video/transcripts/metadata_videolist.js @@ -104,7 +104,7 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager) { self.messenger.render(resp.command, params); self.checkIsUniqVideoTypes(); // Synchronize transcripts field in the `Advanced` tab. - Utils.Storage.set('sub', resp.subs); + // Utils.Storage.set('sub', resp.subs); }) .fail(showServerError); }, diff --git a/cms/urls.py b/cms/urls.py index ac3de948f5..c66477c896 100644 --- a/cms/urls.py +++ b/cms/urls.py @@ -33,7 +33,6 @@ urlpatterns = [ url(r'^transcripts/choose$', contentstore.views.choose_transcripts, name='choose_transcripts'), url(r'^transcripts/replace$', contentstore.views.replace_transcripts, name='replace_transcripts'), url(r'^transcripts/rename$', contentstore.views.rename_transcripts, name='rename_transcripts'), - url(r'^transcripts/save$', contentstore.views.save_transcripts, name='save_transcripts'), url(r'^preview/xblock/(?P.*?)/handler/(?P[^/]*)(?:/(?P.*))?$', contentstore.views.preview_handler, name='preview_handler'), url(r'^xblock/(?P.*?)/handler/(?P[^/]*)(?:/(?P.*))?$', diff --git a/common/lib/xmodule/xmodule/video_module/transcripts_utils.py b/common/lib/xmodule/xmodule/video_module/transcripts_utils.py index fd6bc793c8..2163cdc7e0 100644 --- a/common/lib/xmodule/xmodule/video_module/transcripts_utils.py +++ b/common/lib/xmodule/xmodule/video_module/transcripts_utils.py @@ -361,7 +361,7 @@ def manage_video_subtitles_save(item, user, old_metadata=None, generate_translat This whole action ensures that after user changes video fields, proper `sub` files, corresponding to new values of video fields, will be presented in system. - # 2 convert /static/filename.srt to filename.srt in self.transcripts. + # 2. convert /static/filename.srt to filename.srt in self.transcripts. (it is done to allow user to enter both /static/filename.srt and filename.srt) # 3. Generate transcripts translation only when user clicks `save` button, not while switching tabs. @@ -371,33 +371,32 @@ def manage_video_subtitles_save(item, user, old_metadata=None, generate_translat (To avoid confusing situation if you attempt to correct a translation by uploading a new version of the SRT file with same name). """ - _ = item.runtime.service(item, "i18n").ugettext - # 1. - html5_ids = get_html5_ids(item.html5_sources) + # # 1. + # html5_ids = get_html5_ids(item.html5_sources) - # Youtube transcript source should always have a higher priority than html5 sources. Appending - # `youtube_id_1_0` at the end helps achieve this when we read transcripts list. - possible_video_id_list = html5_ids + [item.youtube_id_1_0] - sub_name = item.sub - for video_id in possible_video_id_list: - if not video_id: - continue - if not sub_name: - remove_subs_from_store(video_id, item) - continue - # copy_or_rename_transcript changes item.sub of module - try: - # updates item.sub with `video_id`, if it is successful. - copy_or_rename_transcript(video_id, sub_name, item, user=user) - except NotFoundError: - # subtitles file `sub_name` is not presented in the system. Nothing to copy or rename. - log.debug( - "Copying %s file content to %s name is failed, " - "original file does not exist.", - sub_name, video_id - ) + # # Youtube transcript source should always have a higher priority than html5 sources. Appending + # # `youtube_id_1_0` at the end helps achieve this when we read transcripts list. + # possible_video_id_list = html5_ids + [item.youtube_id_1_0] + # sub_name = item.sub + # for video_id in possible_video_id_list: + # if not video_id: + # continue + # if not sub_name: + # remove_subs_from_store(video_id, item) + # continue + # # copy_or_rename_transcript changes item.sub of module + # try: + # # updates item.sub with `video_id`, if it is successful. + # copy_or_rename_transcript(video_id, sub_name, item, user=user) + # except NotFoundError: + # # subtitles file `sub_name` is not presented in the system. Nothing to copy or rename. + # log.debug( + # "Copying %s file content to %s name is failed, " + # "original file does not exist.", + # sub_name, video_id + # ) # 2. if generate_translation: @@ -409,6 +408,9 @@ def manage_video_subtitles_save(item, user, old_metadata=None, generate_translat old_langs = set(old_metadata.get('transcripts', {})) if old_metadata else set() new_langs = set(item.transcripts) + html5_ids = get_html5_ids(item.html5_sources) + possible_video_id_list = html5_ids + [item.youtube_id_1_0] + for lang in old_langs.difference(new_langs): # 3a for video_id in possible_video_id_list: if video_id: diff --git a/common/test/acceptance/tests/video/test_studio_video_module.py b/common/test/acceptance/tests/video/test_studio_video_module.py index 6bd1317481..60bf97441c 100644 --- a/common/test/acceptance/tests/video/test_studio_video_module.py +++ b/common/test/acceptance/tests/video/test_studio_video_module.py @@ -46,6 +46,7 @@ class CMSVideoBaseTest(UniqueCourseTest): ) self.assets = [] + self.metadata = None self.addCleanup(YouTubeStubConfig.reset) def _create_course_unit(self, youtube_stub_config=None, subtitles=False): @@ -87,6 +88,7 @@ class CMSVideoBaseTest(UniqueCourseTest): Create a user and make that user a course author Log the user into studio """ + if self.assets: self.course_fixture.add_asset(self.assets) @@ -95,7 +97,7 @@ class CMSVideoBaseTest(UniqueCourseTest): XBlockFixtureDesc('chapter', 'Test Section').add_children( XBlockFixtureDesc('sequential', 'Test Subsection').add_children( XBlockFixtureDesc('vertical', 'Test Unit').add_children( - XBlockFixtureDesc('video', 'Video') + XBlockFixtureDesc('video', 'Video', metadata=self.metadata) ) ) ) diff --git a/common/test/acceptance/tests/video/test_studio_video_transcript.py b/common/test/acceptance/tests/video/test_studio_video_transcript.py index 46d19c9a62..4833a9c2b2 100644 --- a/common/test/acceptance/tests/video/test_studio_video_transcript.py +++ b/common/test/acceptance/tests/video/test_studio_video_transcript.py @@ -123,40 +123,6 @@ class VideoTranscriptTest(CMSVideoBaseTest): self.assertFalse(self.video.is_transcript_button_visible('import')) self.assertTrue(self.video.is_transcript_button_visible('disabled_download_to_edit')) - def test_youtube_id_w_found_state(self): - """ - Scenario: Youtube id only: check "Found" state - Given I have created a Video component with subtitles "t_not_exist" - - And I enter a "http://youtu.be/t_not_exist" source to field number 1 - Then I see status message "Timed Transcript Found" - And I see value "t_not_exist" in the field "Default Timed Transcript" - """ - self._create_video_component(subtitles=True, subtitle_id='t_not_exist') - self.edit_component() - - self.video.set_url_field('http://youtu.be/t_not_exist', 1) - self.assertEqual(self.video.message('status'), 'Timed Transcript Found') - self.open_advanced_tab() - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 't_not_exist')) - - def test_youtube_id_w_same_local_server_subs(self): - """ - Scenario: Youtube id only: check "Found" state when user sets youtube_id with same local and server subs - Given I have created a Video component with subtitles "t__eq_exist" - - And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - And I see status message "Timed Transcript Found" - And I see value "t__eq_exist" in the field "Default Timed Transcript" - """ - self._create_video_component(subtitles=True, subtitle_id='t__eq_exist') - self.edit_component() - - self.video.set_url_field('http://youtu.be/t__eq_exist', 1) - self.assertEqual(self.video.message('status'), 'Timed Transcript Found') - self.open_advanced_tab() - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 't__eq_exist')) - def test_youtube_id_w_different_local_server_sub(self): """ Scenario: Youtube id only: check "Found" state when user sets youtube_id with different local and server subs @@ -167,7 +133,6 @@ class VideoTranscriptTest(CMSVideoBaseTest): And I see button "replace" And I click transcript button "replace" And I see status message "Timed Transcript Found" - And I see value "t_neq_exist" in the field "Default Timed Transcript" """ self._create_video_component(subtitles=True, subtitle_id='t_neq_exist') self.edit_component() @@ -177,8 +142,7 @@ class VideoTranscriptTest(CMSVideoBaseTest): self.assertTrue(self.video.is_transcript_button_visible('replace')) self.video.click_button_subtitles() self.video.wait_for_message('status', 'Timed Transcript Found') - self.open_advanced_tab() - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 't_neq_exist')) + #TODO! Incomplete test, should be completed as a part of replace_transcript def test_html5_source_w_not_found_state(self): """ @@ -197,45 +161,6 @@ class VideoTranscriptTest(CMSVideoBaseTest): self.open_advanced_tab() self.assertTrue(self.video.verify_field_value('Default Timed Transcript', '')) - def test_html5_source_w_found_state(self): - """ - Scenario: html5 source only: check "Found" state - Given I have created a Video component with subtitles "t_not_exist" - - And I enter a "t_not_exist.mp4" source to field number 1 - Then I see status message "Timed Transcript Found" - And I see value "t_not_exist" in the field "Default Timed Transcript" - """ - self._create_video_component(subtitles=True, subtitle_id='t_not_exist') - self.edit_component() - - self.video.set_url_field('t_not_exist.mp4', 1) - self.assertEqual(self.video.message('status'), 'Timed Transcript Found') - self.open_advanced_tab() - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 't_not_exist')) - - def test_set_youtube_id_wo_server(self): - """ - Scenario: User sets youtube_id w/o server but with local subs and one html5 link w/o subs - Given I have created a Video component with subtitles "t_not_exist" - - urls = ['http://youtu.be/t_not_exist', 'test_video_name.mp4'] - for each url in urls do the following - Enter `url` to field number n - Status message "Timed Transcript Found" is shown - And I see value "t_not_exist" in the field "Default Timed Transcript" - """ - self._create_video_component(subtitles=True, subtitle_id='t_not_exist') - self.edit_component() - - urls = ['http://youtu.be/t_not_exist', 'test_video_name.mp4'] - for index, url in enumerate(urls, 1): - self.video.set_url_field(url, index) - self.assertEqual(self.video.message('status'), 'Timed Transcript Found') - - self.open_advanced_tab() - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 't_not_exist')) - def test_set_youtube_id_wo_local(self): """         Scenario: User sets youtube_id w/o local but with server subs and one html5 link w/o @@ -467,7 +392,6 @@ class VideoTranscriptTest(CMSVideoBaseTest): And I upload the transcripts file "uk_transcripts.srt" Then I see status message "Timed Transcript Uploaded Successfully" `download_to_edit` and `upload_new_timed_transcripts` buttons are shown - And I see value "t__eq_exist" in the field "Default Timed Transcript" And I enter a "http://youtu.be/t_not_exist" source to field number 2 Then I see status message "Timed Transcript Found" @@ -487,9 +411,6 @@ class VideoTranscriptTest(CMSVideoBaseTest): self.assertEqual(self.video.message('status'), 'Timed Transcript Uploaded Successfully') self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) - self.open_advanced_tab() - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 't__eq_exist')) - self.open_basic_tab() self.video.set_url_field('http://youtu.be/t_not_exist', 2) self.assertEqual(self.video.message('status'), 'Timed Transcript Found') @@ -552,7 +473,6 @@ class VideoTranscriptTest(CMSVideoBaseTest): If i enter "t_not_exist.mp4" source to field number 1 Then I see status message "Timed Transcript Found" `download_to_edit` and `upload_new_timed_transcripts` buttons are shown - And I see value "t_not_exist" in the field "Default Timed Transcript" And I save changes And then edit the component If i enter "video_name_2.mp4" source to field number 1 Then I see status message "Confirm Timed Transcript" @@ -566,6 +486,7 @@ class VideoTranscriptTest(CMSVideoBaseTest): I see button "use_existing" And I click on it And I see value "video_name_4" in the field "Default Timed Transcript" """ + self.metadata = {'sub': 't_not_exist'} self._create_video_component(subtitles=True, subtitle_id='t_not_exist') self.edit_component() @@ -573,9 +494,7 @@ class VideoTranscriptTest(CMSVideoBaseTest): self.assertEqual(self.video.message('status'), 'Timed Transcript Found') self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) - self.open_advanced_tab() - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 't_not_exist')) - self.open_basic_tab() + self.save_unit_settings() self.edit_component() @@ -584,9 +503,6 @@ class VideoTranscriptTest(CMSVideoBaseTest): self.assertTrue(self.video.is_transcript_button_visible('use_existing')) self.video.click_button('use_existing') self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) - self.open_advanced_tab() - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 'video_name_2')) - self.open_basic_tab() self.video.set_url_field('video_name_3.mp4', 1) self.assertEqual(self.video.message('status'), 'Confirm Timed Transcript') @@ -596,8 +512,7 @@ class VideoTranscriptTest(CMSVideoBaseTest): self.assertEqual(self.video.message('status'), 'Confirm Timed Transcript') self.assertTrue(self.video.is_transcript_button_visible('use_existing')) self.video.click_button('use_existing') - self.open_advanced_tab() - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 'video_name_4')) + #TODO! Incomplete test, should be completed as a part of choose transcript def test_two_fields_only(self): """ @@ -622,6 +537,7 @@ class VideoTranscriptTest(CMSVideoBaseTest): And I click transcript button "use_existing" And I see value "video_name_3" in the field "Default Timed Transcript" """ + self.metadata = {'sub': 't_not_exist'} self._create_video_component(subtitles=True, subtitle_id='t_not_exist') self.edit_component() @@ -640,8 +556,7 @@ class VideoTranscriptTest(CMSVideoBaseTest): self.assertEqual(self.video.message('status'), 'Confirm Timed Transcript') self.assertTrue(self.video.is_transcript_button_visible('use_existing')) self.video.click_button('use_existing') - self.open_advanced_tab() - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 'video_name_3')) + #TODO! Incomplete test, should be completed as a part of rename_transcript def test_upload_subtitles(self): """ @@ -754,30 +669,6 @@ class VideoTranscriptTest(CMSVideoBaseTest): self.edit_component() self.assertEqual(self.video.message('status'), 'Timed Transcript Found') - def test_advanced_tab_transcript_fields(self): - """ - Scenario: Change transcripts field in Advanced tab - Given I have created a Video component with subtitles "t_not_exist" - - After I enter a "video_name_1.mp4" source to field number 1 Then I see status message "No Timed Transcript" - Open tab "Advanced" and set value "t_not_exist" to the field "Default Timed Transcript" - After saving the changes video captions should be visible - When I edit the component Then I see status message "Timed Transcript Found" - And I see value "video_name_1" in the field "Default Timed Transcript" - """ - self._create_video_component(subtitles=True, subtitle_id='t_not_exist') - self.edit_component() - - self.video.set_url_field('video_name_1.mp4', 1) - self.assertEqual(self.video.message('status'), 'No Timed Transcript') - self.open_advanced_tab() - self.video.set_field_value('Default Timed Transcript', 't_not_exist') - self.save_unit_settings() - self.assertTrue(self.video.is_captions_visible()) - self.edit_component() - self.assertEqual(self.video.message('status'), 'Timed Transcript Found') - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 'video_name_1')) - def test_non_ascii_transcripts(self): """ Scenario: Check non-ascii (chinese) transcripts @@ -797,33 +688,6 @@ class VideoTranscriptTest(CMSVideoBaseTest): self.save_unit_settings() self.assertTrue(self.video.is_captions_visible()) - def test_module_metadata_save(self): - """ - Scenario: Check saving module metadata on switching between tabs - Given I have created a Video component with subtitles "t_not_exist" - - After I enter a "video_name_1.mp4" source to field number 1 I should see status message "No Timed Transcript" - Open tab "Advanced" and set value "t_not_exist" to the field "Default Timed Transcript" - When I open tab "Basic" Then I see status message "Timed Transcript Found" - After saving the changes video captions should be visible - When I edit the component I should see status message "Timed Transcript Found" - And I see value "video_name_1" in the field "Default Timed Transcript" - """ - self._create_video_component(subtitles=True, subtitle_id='t_not_exist') - self.edit_component() - - self.video.set_url_field('video_name_1.mp4', 1) - self.assertEqual(self.video.message('status'), 'No Timed Transcript') - self.open_advanced_tab() - self.video.set_field_value('Default Timed Transcript', 't_not_exist') - self.open_basic_tab() - self.assertEqual(self.video.message('status'), 'Timed Transcript Found') - self.save_unit_settings() - self.assertTrue(self.video.is_captions_visible()) - self.edit_component() - self.assertEqual(self.video.message('status'), 'Timed Transcript Found') - self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 'video_name_1')) - def test_upload_subtitles_w_different_names2(self): """ Scenario: Uploading subtitles for file with periods in it does not effect the uploaded transcript in anyway diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index a158986b21..2cf760366b 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -1249,7 +1249,6 @@ class TestEditorSavedMethod(BaseTestXmodule): # calling editor_saved will generate new file subs_video.srt.sjson for html5_sources item.editor_saved(self.user, old_metadata, None) self.assertIsInstance(Transcript.get_asset(item.location, 'subs_3_yD_cEKoCk.srt.sjson'), StaticContent) - self.assertIsInstance(Transcript.get_asset(item.location, 'subs_video.srt.sjson'), StaticContent) @ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split) def test_editor_saved_when_youtube_and_html5_subs_exist(self, default_store):