Commit c7418a30 by zubair-arbi

Merge pull request #5240 from edx/zub/bugfix/tnl-324-downloadvideoexportimport

Don't set 'download_video' field on importing video from xml until expli...
parents 298ad30a bdf2c286
...@@ -549,7 +549,8 @@ class VideoExportTestCase(VideoDescriptorTestBase): ...@@ -549,7 +549,8 @@ class VideoExportTestCase(VideoDescriptorTestBase):
Test XML export with defaults. Test XML export with defaults.
""" """
xml = self.descriptor.definition_to_xml(None) 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)) self.assertEquals(expected, etree.tostring(xml, pretty_print=True))
......
...@@ -297,6 +297,11 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler ...@@ -297,6 +297,11 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
editable_fields = super(VideoDescriptor, self).editable_metadata_fields editable_fields = super(VideoDescriptor, self).editable_metadata_fields
self.source_visible = False 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 self.source:
# If `source` field value exist in the `html5_sources` field values, # If `source` field value exist in the `html5_sources` field values,
# then delete `source` field value and use value from `html5_sources` field. # then delete `source` field value and use value from `html5_sources` field.
...@@ -305,7 +310,6 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler ...@@ -305,7 +310,6 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
self.download_video = True self.download_video = True
else: # Otherwise, `source` field value will be used. else: # Otherwise, `source` field value will be used.
self.source_visible = True self.source_visible = True
download_video = editable_fields['download_video']
if not download_video['explicitly_set']: if not download_video['explicitly_set']:
self.download_video = True self.download_video = True
......
...@@ -104,7 +104,7 @@ class CommandsTestBase(TestCase): ...@@ -104,7 +104,7 @@ class CommandsTestBase(TestCase):
video_id = test_course_key.make_usage_key('video', 'Welcome').to_deprecated_string() video_id = test_course_key.make_usage_key('video', 'Welcome').to_deprecated_string()
self.assertEqual(dump[video_id]['category'], 'video') 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']) self.assertIn('youtube_id_1_0', dump[video_id]['metadata'])
# Check if there are the right number of elements # Check if there are the right number of elements
......
...@@ -155,7 +155,7 @@ class TestGetHtmlMethod(BaseTestXmodule): ...@@ -155,7 +155,7 @@ class TestGetHtmlMethod(BaseTestXmodule):
<video show_captions="true" <video show_captions="true"
display_name="A Name" display_name="A Name"
sub="{sub}" download_track="{download_track}" 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.mp4"/>
<source src="example.webm"/> <source src="example.webm"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment