refactor: remove deprecated runtime.course_id from VideoBlock
We will use `context_key` instead.
This commit is contained in:
@@ -1424,7 +1424,6 @@ class TestVideoBlockStudentViewJson(BaseTestVideoXBlock, CacheIsolationTestCase)
|
||||
self.initialize_block(data=sample_xml)
|
||||
self.video = self.item_descriptor
|
||||
self.video.runtime.handler_url = Mock(return_value=self.transcript_url)
|
||||
self.video.runtime.course_id = MagicMock()
|
||||
|
||||
def setup_val_video(self, associate_course_in_val=False):
|
||||
"""
|
||||
@@ -1527,7 +1526,6 @@ class TestVideoBlockStudentViewJson(BaseTestVideoXBlock, CacheIsolationTestCase)
|
||||
self.initialize_block(data=sample_xml)
|
||||
self.video = self.item_descriptor
|
||||
self.video.runtime.handler_url = Mock(return_value=self.transcript_url)
|
||||
self.video.runtime.course_id = MagicMock()
|
||||
result = self.get_result()
|
||||
self.verify_result_with_youtube_url(result)
|
||||
|
||||
@@ -1595,7 +1593,6 @@ class VideoBlockTest(TestCase, VideoBlockTestBase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.descriptor.runtime.handler_url = MagicMock()
|
||||
self.descriptor.runtime.course_id = MagicMock()
|
||||
self.temp_dir = mkdtemp()
|
||||
file_system = OSFS(self.temp_dir)
|
||||
self.file_system = file_system.makedir(EXPORT_IMPORT_COURSE_DIR, recreate=True)
|
||||
|
||||
@@ -701,7 +701,6 @@ class VideoExportTestCase(VideoBlockTestBase):
|
||||
self.descriptor.download_video = True
|
||||
self.descriptor.transcripts = {'ua': 'ukrainian_translation.srt', 'ge': 'german_translation.srt'}
|
||||
self.descriptor.edx_video_id = edx_video_id
|
||||
self.descriptor.runtime.course_id = MagicMock()
|
||||
|
||||
xml = self.descriptor.definition_to_xml(self.file_system)
|
||||
parser = etree.XMLParser(remove_blank_text=True)
|
||||
@@ -731,7 +730,7 @@ class VideoExportTestCase(VideoBlockTestBase):
|
||||
video_id=edx_video_id,
|
||||
static_dir=EXPORT_IMPORT_STATIC_DIR,
|
||||
resource_fs=self.file_system,
|
||||
course_id=str(self.descriptor.runtime.course_id.for_branch(None)),
|
||||
course_id=self.descriptor.scope_ids.usage_id.context_key,
|
||||
)
|
||||
|
||||
@patch('xmodule.video_module.video_module.edxval_api')
|
||||
@@ -740,7 +739,6 @@ class VideoExportTestCase(VideoBlockTestBase):
|
||||
mock_val_api.ValVideoNotFoundError = _MockValVideoNotFoundError
|
||||
mock_val_api.export_to_xml = Mock(side_effect=mock_val_api.ValVideoNotFoundError)
|
||||
self.descriptor.edx_video_id = 'test_edx_video_id'
|
||||
self.descriptor.runtime.course_id = MagicMock()
|
||||
|
||||
xml = self.descriptor.definition_to_xml(self.file_system)
|
||||
parser = etree.XMLParser(remove_blank_text=True)
|
||||
@@ -861,7 +859,6 @@ class VideoBlockStudentViewDataTestCase(unittest.TestCase):
|
||||
Ensure that student_view_data returns the expected results for video modules.
|
||||
"""
|
||||
descriptor = instantiate_descriptor(**field_data)
|
||||
descriptor.runtime.course_id = MagicMock()
|
||||
student_view_data = descriptor.student_view_data()
|
||||
assert student_view_data == expected_student_view_data
|
||||
|
||||
@@ -896,7 +893,6 @@ class VideoBlockStudentViewDataTestCase(unittest.TestCase):
|
||||
}
|
||||
|
||||
descriptor = instantiate_descriptor(edx_video_id='example_id', only_on_web=False)
|
||||
descriptor.runtime.course_id = MagicMock()
|
||||
descriptor.runtime.handler_url = MagicMock()
|
||||
student_view_data = descriptor.student_view_data()
|
||||
expected_video_data = {'hls': {'url': 'http://www.meowmix.com', 'file_size': 25556}}
|
||||
|
||||
@@ -371,7 +371,7 @@ class VideoBlock(
|
||||
poster = None
|
||||
if edxval_api and self.edx_video_id:
|
||||
poster = edxval_api.get_course_video_image_url(
|
||||
course_id=self.runtime.course_id.for_branch(None),
|
||||
course_id=self.scope_ids.usage_id.context_key.for_branch(None),
|
||||
edx_video_id=self.edx_video_id.strip()
|
||||
)
|
||||
|
||||
@@ -741,12 +741,11 @@ class VideoBlock(
|
||||
# (i.e. `self.transcripts`) on import and older open-releases (<= ginkgo),
|
||||
# who do not have deprecated contentstore yet, can also import and use new-style
|
||||
# transcripts into their openedX instances.
|
||||
|
||||
exported_metadata = edxval_api.export_to_xml(
|
||||
video_id=edx_video_id,
|
||||
resource_fs=resource_fs,
|
||||
static_dir=EXPORT_IMPORT_STATIC_DIR,
|
||||
course_id=str(self.runtime.course_id.for_branch(None))
|
||||
course_id=self.scope_ids.usage_id.context_key.for_branch(None),
|
||||
)
|
||||
# Update xml with edxval metadata
|
||||
xml.append(exported_metadata['xml'])
|
||||
@@ -832,7 +831,7 @@ class VideoBlock(
|
||||
if self.edx_video_id and edxval_api:
|
||||
|
||||
val_profiles = ['youtube', 'desktop_webm', 'desktop_mp4']
|
||||
if HLSPlaybackEnabledFlag.feature_enabled(self.runtime.course_id.for_branch(None)):
|
||||
if HLSPlaybackEnabledFlag.feature_enabled(self.scope_ids.usage_id.context_key.for_branch(None)):
|
||||
val_profiles.append('hls')
|
||||
|
||||
# Get video encodings for val profiles.
|
||||
|
||||
Reference in New Issue
Block a user