Merge pull request #5240 from edx/zub/bugfix/tnl-324-downloadvideoexportimport
Don't set 'download_video' field on importing video from xml until expli...
This commit is contained in:
@@ -549,7 +549,8 @@ class VideoExportTestCase(VideoDescriptorTestBase):
|
||||
Test XML export with defaults.
|
||||
"""
|
||||
xml = self.descriptor.definition_to_xml(None)
|
||||
expected = '<video url_name="SampleProblem"/>\n'
|
||||
# Check that download_video field is also set to default (False) in xml for backward compatibility
|
||||
expected = '<video url_name="SampleProblem" download_video="false"/>\n'
|
||||
self.assertEquals(expected, etree.tostring(xml, pretty_print=True))
|
||||
|
||||
|
||||
|
||||
@@ -297,6 +297,11 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
|
||||
editable_fields = super(VideoDescriptor, self).editable_metadata_fields
|
||||
|
||||
self.source_visible = False
|
||||
# Set download_video field to default value if its not explicitly set for backward compatibility.
|
||||
download_video = editable_fields['download_video']
|
||||
if not download_video['explicitly_set']:
|
||||
self.download_video = self.download_video
|
||||
|
||||
if self.source:
|
||||
# If `source` field value exist in the `html5_sources` field values,
|
||||
# then delete `source` field value and use value from `html5_sources` field.
|
||||
@@ -305,7 +310,6 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
|
||||
self.download_video = True
|
||||
else: # Otherwise, `source` field value will be used.
|
||||
self.source_visible = True
|
||||
download_video = editable_fields['download_video']
|
||||
if not download_video['explicitly_set']:
|
||||
self.download_video = True
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ class CommandsTestBase(TestCase):
|
||||
|
||||
video_id = test_course_key.make_usage_key('video', 'Welcome').to_deprecated_string()
|
||||
self.assertEqual(dump[video_id]['category'], 'video')
|
||||
self.assertEqual(len(dump[video_id]['metadata']), 4)
|
||||
self.assertEqual(len(dump[video_id]['metadata']), 5)
|
||||
self.assertIn('youtube_id_1_0', dump[video_id]['metadata'])
|
||||
|
||||
# Check if there are the right number of elements
|
||||
|
||||
@@ -155,7 +155,7 @@ class TestGetHtmlMethod(BaseTestXmodule):
|
||||
<video show_captions="true"
|
||||
display_name="A Name"
|
||||
sub="{sub}" download_track="{download_track}"
|
||||
start_time="01:00:03" end_time="01:00:10"
|
||||
start_time="01:00:03" end_time="01:00:10" download_video="true"
|
||||
>
|
||||
<source src="example.mp4"/>
|
||||
<source src="example.webm"/>
|
||||
|
||||
Reference in New Issue
Block a user