Commit f957b344 by polesye Committed by Alexander Kryklia

BLD-811: Revert functionality.

parent b1fa5ec5
...@@ -40,11 +40,12 @@ def correct_video_settings(_step): ...@@ -40,11 +40,12 @@ def correct_video_settings(_step):
# advanced # advanced
['Display Name', 'Video', False], ['Display Name', 'Video', False],
['Download Transcript', '', False],
['End Time', '00:00:00', False], ['End Time', '00:00:00', False],
['HTML5 Transcript', '', False], ['HTML5 Transcript', '', False],
['Show Transcript', 'True', False], ['Show Transcript', 'True', False],
['Start Time', '00:00:00', False], ['Start Time', '00:00:00', False],
['Transcript Download Allowed', 'False', False], # ['Transcript Download Allowed', 'False', False],
['Video Download Allowed', 'False', False], ['Video Download Allowed', 'False', False],
['Video Sources', '', False], ['Video Sources', '', False],
['Youtube ID', 'OEoXaMPEzfM', False], ['Youtube ID', 'OEoXaMPEzfM', False],
......
...@@ -384,7 +384,7 @@ class VideoDescriptorImportTestCase(unittest.TestCase): ...@@ -384,7 +384,7 @@ class VideoDescriptorImportTestCase(unittest.TestCase):
'start_time': datetime.timedelta(seconds=1), 'start_time': datetime.timedelta(seconds=1),
'end_time': datetime.timedelta(seconds=60), 'end_time': datetime.timedelta(seconds=60),
'track': 'http://www.example.com/track', 'track': 'http://www.example.com/track',
'download_track': True, # 'download_track': True,
'html5_sources': ['http://www.example.com/source.mp4'], 'html5_sources': ['http://www.example.com/source.mp4'],
'data': '', 'data': '',
}) })
...@@ -414,7 +414,7 @@ class VideoDescriptorImportTestCase(unittest.TestCase): ...@@ -414,7 +414,7 @@ class VideoDescriptorImportTestCase(unittest.TestCase):
'start_time': datetime.timedelta(seconds=1), 'start_time': datetime.timedelta(seconds=1),
'end_time': datetime.timedelta(seconds=60), 'end_time': datetime.timedelta(seconds=60),
'track': 'http://www.example.com/track', 'track': 'http://www.example.com/track',
'download_track': True, # 'download_track': True,
'html5_sources': ['http://www.example.com/source.mp4'], 'html5_sources': ['http://www.example.com/source.mp4'],
'data': '' 'data': ''
}) })
...@@ -444,7 +444,7 @@ class VideoDescriptorImportTestCase(unittest.TestCase): ...@@ -444,7 +444,7 @@ class VideoDescriptorImportTestCase(unittest.TestCase):
'start_time': datetime.timedelta(seconds=1), 'start_time': datetime.timedelta(seconds=1),
'end_time': datetime.timedelta(seconds=60), 'end_time': datetime.timedelta(seconds=60),
'track': 'http://www.example.com/track', 'track': 'http://www.example.com/track',
'download_track': True, # 'download_track': True,
'html5_sources': ['http://www.example.com/source.mp4'], 'html5_sources': ['http://www.example.com/source.mp4'],
'data': '' 'data': ''
}) })
......
...@@ -119,7 +119,7 @@ class VideoFields(object): ...@@ -119,7 +119,7 @@ class VideoFields(object):
# `track` is deprecated field and should not be used in future. # `track` is deprecated field and should not be used in future.
# `download_track` is used instead. # `download_track` is used instead.
track = String( track = String(
help="The external URL to download the timed transcript track.", help="The external URL to download the timed transcript track. This appears as a link beneath the video.",
display_name="Download Transcript", display_name="Download Transcript",
scope=Scope.settings, scope=Scope.settings,
default='' default=''
...@@ -215,11 +215,14 @@ class VideoModule(VideoFields, XModule): ...@@ -215,11 +215,14 @@ class VideoModule(VideoFields, XModule):
elif self.html5_sources: elif self.html5_sources:
sources['main'] = self.html5_sources[0] sources['main'] = self.html5_sources[0]
if self.download_track: # Commented due to the reason described in BLD-811.
if self.track: # if self.download_track:
track_url = self.track # if self.track:
elif self.sub: # track_url = self.track
track_url = self.runtime.handler_url(self, 'download_transcript') # elif self.sub:
# track_url = self.runtime.handler_url(self, 'download_transcript')
track_url = self.track
return self.system.render_template('video.html', { return self.system.render_template('video.html', {
'ajax_url': self.system.ajax_url + '/save_user_state', 'ajax_url': self.system.ajax_url + '/save_user_state',
...@@ -312,10 +315,16 @@ class VideoDescriptor(VideoFields, TabsEditingDescriptor, EmptyDataRawDescriptor ...@@ -312,10 +315,16 @@ class VideoDescriptor(VideoFields, TabsEditingDescriptor, EmptyDataRawDescriptor
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
''' '''
Mostly handles backward compatibility issues.
Track was deprecated field, but functionality was reverted,
this is commented out because might be used in future.
###
`track` is deprecated field. `track` is deprecated field.
If `track` field exists show `track` field on front-end as not-editable If `track` field exists show `track` field on front-end as not-editable
but clearable. Dropdown `download_track` is a new field and it has value but clearable. Dropdown `download_track` is a new field and it has value
True. True.
###
`source` is deprecated field. `source` is deprecated field.
a) If `source` exists and `source` is not `html5_sources`: show `source` a) If `source` exists and `source` is not `html5_sources`: show `source`
...@@ -335,12 +344,13 @@ class VideoDescriptor(VideoFields, TabsEditingDescriptor, EmptyDataRawDescriptor ...@@ -335,12 +344,13 @@ class VideoDescriptor(VideoFields, TabsEditingDescriptor, EmptyDataRawDescriptor
editable_fields = self.editable_metadata_fields editable_fields = self.editable_metadata_fields
self.track_visible = False # Commented due to the reason described in BLD-811.
if self.track: # self.track_visible = False
self.track_visible = True # if self.track:
download_track = editable_fields['download_track'] # self.track_visible = True
if not download_track['explicitly_set']: # download_track = editable_fields['download_track']
self.download_track = True # if not download_track['explicitly_set']:
# self.download_track = True
self.source_visible = False self.source_visible = False
if self.source: if self.source:
...@@ -359,11 +369,15 @@ class VideoDescriptor(VideoFields, TabsEditingDescriptor, EmptyDataRawDescriptor ...@@ -359,11 +369,15 @@ class VideoDescriptor(VideoFields, TabsEditingDescriptor, EmptyDataRawDescriptor
def editable_metadata_fields(self): def editable_metadata_fields(self):
editable_fields = super(VideoDescriptor, self).editable_metadata_fields editable_fields = super(VideoDescriptor, self).editable_metadata_fields
if hasattr(self, 'track_visible'): # Commented due to the reason described in BLD-811.
if self.track_visible: # if hasattr(self, 'track_visible'):
editable_fields['track']['non_editable'] = True # if self.track_visible:
else: # editable_fields['track']['non_editable'] = True
editable_fields.pop('track') # else:
# editable_fields.pop('track')
if 'download_track' in editable_fields:
editable_fields.pop('download_track')
if hasattr(self, 'source_visible'): if hasattr(self, 'source_visible'):
if self.source_visible: if self.source_visible:
......
...@@ -5,6 +5,7 @@ from mock import patch, PropertyMock ...@@ -5,6 +5,7 @@ from mock import patch, PropertyMock
import os import os
import tempfile import tempfile
import textwrap import textwrap
import unittest
from functools import partial from functools import partial
from xmodule.contentstore.content import StaticContent from xmodule.contentstore.content import StaticContent
...@@ -70,7 +71,7 @@ class TestVideoYouTube(TestVideo): ...@@ -70,7 +71,7 @@ class TestVideoYouTube(TestVideo):
'general_speed': 1.0, 'general_speed': 1.0,
'start': 3603.0, 'start': 3603.0,
'sub': u'a_sub_file.srt.sjson', 'sub': u'a_sub_file.srt.sjson',
'track': None, 'track': '',
'youtube_streams': _create_youtube_string(self.item_module), 'youtube_streams': _create_youtube_string(self.item_module),
'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', False), 'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', False),
'yt_test_timeout': 1500, 'yt_test_timeout': 1500,
...@@ -125,7 +126,7 @@ class TestVideoNonYouTube(TestVideo): ...@@ -125,7 +126,7 @@ class TestVideoNonYouTube(TestVideo):
'general_speed': 1.0, 'general_speed': 1.0,
'start': 3603.0, 'start': 3603.0,
'sub': u'a_sub_file.srt.sjson', 'sub': u'a_sub_file.srt.sjson',
'track': None, 'track': '',
'youtube_streams': '1.00:OEoXaMPEzfM', 'youtube_streams': '1.00:OEoXaMPEzfM',
'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', True), 'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', True),
'yt_test_timeout': 1500, 'yt_test_timeout': 1500,
...@@ -205,7 +206,7 @@ class TestGetHtmlMethod(BaseTestXmodule): ...@@ -205,7 +206,7 @@ class TestGetHtmlMethod(BaseTestXmodule):
'sub': u'a_sub_file.srt.sjson', 'sub': u'a_sub_file.srt.sjson',
'speed': 'null', 'speed': 'null',
'general_speed': 1.0, 'general_speed': 1.0,
'track': None, 'track': u'http://www.example.com/track',
'youtube_streams': '1.00:OEoXaMPEzfM', 'youtube_streams': '1.00:OEoXaMPEzfM',
'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', True), 'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', True),
'yt_test_timeout': 1500, 'yt_test_timeout': 1500,
...@@ -220,13 +221,14 @@ class TestGetHtmlMethod(BaseTestXmodule): ...@@ -220,13 +221,14 @@ class TestGetHtmlMethod(BaseTestXmodule):
) )
self.initialize_module(data=DATA) self.initialize_module(data=DATA)
track_url = self.item_descriptor.xmodule_runtime.handler_url(self.item_module, 'download_transcript') # track_url = self.item_descriptor.xmodule_runtime.handler_url(self.item_module, 'download_transcript')
context = self.item_module.render('student_view').content context = self.item_module.render('student_view').content
expected_context.update({ expected_context.update({
'ajax_url': self.item_descriptor.xmodule_runtime.ajax_url + '/save_user_state', 'ajax_url': self.item_descriptor.xmodule_runtime.ajax_url + '/save_user_state',
'track': track_url if data['expected_track_url'] == u'a_sub_file.srt.sjson' else data['expected_track_url'], # 'track': track_url if data['expected_track_url'] == u'a_sub_file.srt.sjson' else data['expected_track_url'],
'track': u'http://www.example.com/track' if data['track'] else '',
'sub': data['sub'], 'sub': data['sub'],
'id': self.item_module.location.html_id(), 'id': self.item_module.location.html_id(),
}) })
...@@ -309,7 +311,7 @@ class TestGetHtmlMethod(BaseTestXmodule): ...@@ -309,7 +311,7 @@ class TestGetHtmlMethod(BaseTestXmodule):
'general_speed': 1.0, 'general_speed': 1.0,
'start': 3603.0, 'start': 3603.0,
'sub': u'a_sub_file.srt.sjson', 'sub': u'a_sub_file.srt.sjson',
'track': None, 'track': '',
'youtube_streams': '1.00:OEoXaMPEzfM', 'youtube_streams': '1.00:OEoXaMPEzfM',
'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', True), 'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', True),
'yt_test_timeout': 1500, 'yt_test_timeout': 1500,
...@@ -447,6 +449,7 @@ class TestVideoDescriptorInitialization(BaseTestXmodule): ...@@ -447,6 +449,7 @@ class TestVideoDescriptorInitialization(BaseTestXmodule):
self.assertNotIn('source', fields) self.assertNotIn('source', fields)
self.assertFalse(self.item_module.download_video) self.assertFalse(self.item_module.download_video)
@unittest.skip('Skipped due to the reason described in BLD-811')
def test_track_is_not_empty(self): def test_track_is_not_empty(self):
metatdata = { metatdata = {
'track': 'http://example.org/track', 'track': 'http://example.org/track',
...@@ -460,6 +463,7 @@ class TestVideoDescriptorInitialization(BaseTestXmodule): ...@@ -460,6 +463,7 @@ class TestVideoDescriptorInitialization(BaseTestXmodule):
self.assertTrue(self.item_module.download_track) self.assertTrue(self.item_module.download_track)
self.assertTrue(self.item_module.track_visible) self.assertTrue(self.item_module.track_visible)
@unittest.skip('Skipped due to the reason described in BLD-811')
@patch('xmodule.x_module.XModuleDescriptor.editable_metadata_fields', new_callable=PropertyMock) @patch('xmodule.x_module.XModuleDescriptor.editable_metadata_fields', new_callable=PropertyMock)
def test_download_track_is_explicitly_set(self, mock_editable_fields): def test_download_track_is_explicitly_set(self, mock_editable_fields):
mock_editable_fields.return_value = { mock_editable_fields.return_value = {
...@@ -510,7 +514,7 @@ class TestVideoDescriptorInitialization(BaseTestXmodule): ...@@ -510,7 +514,7 @@ class TestVideoDescriptorInitialization(BaseTestXmodule):
self.assertFalse(self.item_module.download_track) self.assertFalse(self.item_module.download_track)
self.assertTrue(self.item_module.track_visible) self.assertTrue(self.item_module.track_visible)
@unittest.skip('Skipped due to the reason described in BLD-811')
def test_track_is_empty(self): def test_track_is_empty(self):
metatdata = { metatdata = {
'track': '', 'track': '',
......
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