diff --git a/cms/djangoapps/contentstore/management/commands/tests/test_migrate_transcripts.py b/cms/djangoapps/contentstore/management/commands/tests/test_migrate_transcripts.py index 58e81d86e7..113fc1fa81 100644 --- a/cms/djangoapps/contentstore/management/commands/tests/test_migrate_transcripts.py +++ b/cms/djangoapps/contentstore/management/commands/tests/test_migrate_transcripts.py @@ -18,6 +18,7 @@ from openedx.core.djangoapps.video_config.models import ( from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory +from xmodule.video_module import VideoBlock from xmodule.video_module.transcripts_utils import save_to_store from edxval import api as api from testfixtures import LogCapture @@ -105,9 +106,9 @@ class TestMigrateTranscripts(ModuleStoreTestCase): youtube="1.0:p2Q6BrNhdh8,0.75:izygArpw-Qo,1.25:1EeWXzPdhSA,1.5:rABDYkeK0x8" show_captions="false" download_track="false" - start_time="00:00:01" + start_time="1.0" download_video="false" - end_time="00:01:00"> + end_time="60.0"> @@ -122,9 +123,9 @@ class TestMigrateTranscripts(ModuleStoreTestCase): youtube="1.0:p2Q6BrNhdh8,0.75:izygArpw-Qo,1.25:1EeWXzPdhSA,1.5:rABDYkeK0x8" show_captions="false" download_track="false" - start_time="00:00:01" + start_time="1.0" download_video="false" - end_time="00:01:00"> + end_time="60.0"> @@ -133,11 +134,11 @@ class TestMigrateTranscripts(ModuleStoreTestCase): ''' self.video_descriptor = ItemFactory.create( parent_location=self.course.location, category='video', - data={'data': video_sample_xml} + **VideoBlock.parse_video_xml(video_sample_xml) ) self.video_descriptor_2 = ItemFactory.create( parent_location=self.course_2.location, category='video', - data={'data': video_sample_xml_2} + **VideoBlock.parse_video_xml(video_sample_xml_2) ) save_to_store(SRT_FILEDATA, 'subs_grmtran1.srt', 'text/srt', self.video_descriptor.location) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 5b48c6fd9e..e0df1a65ac 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -54,6 +54,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, chec from xmodule.modulestore.xml_exporter import export_course_to_xml from xmodule.modulestore.xml_importer import import_course_from_xml, perform_xlint from xmodule.seq_module import SequenceDescriptor +from xmodule.video_module import VideoBlock TEST_DATA_CONTENTSTORE = copy.deepcopy(settings.CONTENTSTORE) TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'] = 'test_xcontent_%s' % uuid4().hex @@ -1815,15 +1816,15 @@ class MetadataSaveTestCase(ContentStoreTestCase): """ self.video_descriptor = ItemFactory.create( parent_location=course.location, category='video', - data={'data': video_sample_xml} + **VideoBlock.parse_video_xml(video_sample_xml) ) def test_metadata_not_persistence(self): @@ -1840,7 +1841,6 @@ class MetadataSaveTestCase(ContentStoreTestCase): 'youtube_id_1_5', 'start_time', 'end_time', - 'source', 'html5_sources', 'track' } diff --git a/cms/djangoapps/contentstore/views/tests/test_course_index.py b/cms/djangoapps/contentstore/views/tests/test_course_index.py index 42879eed70..d1f0154538 100644 --- a/cms/djangoapps/contentstore/views/tests/test_course_index.py +++ b/cms/djangoapps/contentstore/views/tests/test_course_index.py @@ -718,7 +718,7 @@ class TestCourseReIndex(CourseTestCase): course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1) - @mock.patch('xmodule.video_module.VideoDescriptor.index_dictionary') + @mock.patch('xmodule.video_module.VideoBlock.index_dictionary') def test_reindex_video_error_json_responses(self, mock_index_dictionary): """ Test json response with mocked error data for video @@ -828,7 +828,7 @@ class TestCourseReIndex(CourseTestCase): course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1) - @mock.patch('xmodule.video_module.VideoDescriptor.index_dictionary') + @mock.patch('xmodule.video_module.VideoBlock.index_dictionary') def test_indexing_video_error_responses(self, mock_index_dictionary): """ Test do_course_reindex response with mocked error data for video diff --git a/cms/djangoapps/contentstore/views/tests/test_transcripts.py b/cms/djangoapps/contentstore/views/tests/test_transcripts.py index 05e03aebd6..8dc31a1284 100644 --- a/cms/djangoapps/contentstore/views/tests/test_transcripts.py +++ b/cms/djangoapps/contentstore/views/tests/test_transcripts.py @@ -21,6 +21,7 @@ from xmodule.contentstore.content import StaticContent from xmodule.contentstore.django import contentstore from xmodule.exceptions import NotFoundError from xmodule.modulestore.django import modulestore +from xmodule.video_module import VideoBlock from xmodule.video_module.transcripts_utils import ( GetTranscriptsFromYouTubeException, Transcript, @@ -94,7 +95,9 @@ class BaseTranscripts(CourseTestCase): self.item = modulestore().get_item(self.video_usage_key) # hI10vDNYz4M - valid Youtube ID with transcripts. # JMD_ifUUfsU, AKqURZnYqpk, DYpADpL7jAY - valid Youtube IDs without transcripts. - self.item.data = ' """ with self.assertRaises(mock_val_api.ValCannotCreateError): - VideoDescriptor.from_xml(xml_data, module_system, id_generator=Mock()) + VideoBlock.from_xml(xml_data, module_system, id_generator=Mock()) -class VideoExportTestCase(VideoDescriptorTestBase): +class VideoExportTestCase(VideoBlockTestBase): """ - Make sure that VideoDescriptor can export itself to XML correctly. + Make sure that VideoBlock can export itself to XML correctly. """ def setUp(self): @@ -773,7 +773,7 @@ class VideoExportTestCase(VideoDescriptorTestBase): xml = self.descriptor.definition_to_xml(self.file_system) parser = etree.XMLParser(remove_blank_text=True) - xml_string = '