|
82 | 82 | ["ur", "Urdu"] |
83 | 83 | ) |
84 | 84 |
|
| 85 | +if settings.USE_EXTRACTED_VIDEO_BLOCK: |
| 86 | + get_available_transcript_languages_path = ( |
| 87 | + 'xblocks_contrib.video.video_transcripts_utils.get_available_transcript_languages' |
| 88 | + ) |
| 89 | +else: |
| 90 | + get_available_transcript_languages_path = ( |
| 91 | + 'openedx.core.djangoapps.video_config.transcripts_utils.get_available_transcript_languages' |
| 92 | + ) |
| 93 | + |
85 | 94 |
|
86 | 95 | def instantiate_block(**field_data): |
87 | 96 | """ |
@@ -320,7 +329,7 @@ def test_parse_xml(self): |
320 | 329 |
|
321 | 330 | @XBlockAside.register_temp_plugin(AsideTestType, "test_aside") |
322 | 331 | @patch('xmodule.video_block.video_block.VideoBlock.load_file') |
323 | | - @patch('xmodule.video_block.video_block.is_pointer_tag') |
| 332 | + @patch(f'{VideoBlock.__module__}.is_pointer_tag') |
324 | 333 | @ddt.data(True, False) |
325 | 334 | def test_parse_xml_with_asides(self, video_xml_has_aside, mock_is_pointer_tag, mock_load_file): |
326 | 335 | """Test that `parse_xml` parses asides from the video xml""" |
@@ -642,7 +651,7 @@ def test_import_with_float_times(self): |
642 | 651 | 'data': '' |
643 | 652 | }) |
644 | 653 |
|
645 | | - @patch('xmodule.video_block.video_block.edxval_api') |
| 654 | + @patch(f'{VideoBlock.__module__}.edxval_api') |
646 | 655 | def test_import_val_data(self, mock_val_api): |
647 | 656 | """ |
648 | 657 | Test that `parse_xml` works method works as expected. |
@@ -687,7 +696,7 @@ def mock_val_import(xml, edx_video_id, resource_fs, static_dir, external_transcr |
687 | 696 | course_id='test_course_id' |
688 | 697 | ) |
689 | 698 |
|
690 | | - @patch('xmodule.video_block.video_block.edxval_api') |
| 699 | + @patch(f'{VideoBlock.__module__}.edxval_api') |
691 | 700 | def test_import_val_data_invalid(self, mock_val_api): |
692 | 701 | mock_val_api.ValCannotCreateError = _MockValCannotCreateError |
693 | 702 | mock_val_api.import_from_xml = Mock(side_effect=mock_val_api.ValCannotCreateError) |
@@ -715,7 +724,7 @@ def setUp(self): |
715 | 724 | self.file_system = OSFS(self.temp_dir) |
716 | 725 | self.addCleanup(shutil.rmtree, self.temp_dir) |
717 | 726 |
|
718 | | - @patch('xmodule.video_block.video_block.edxval_api') |
| 727 | + @patch(f'{VideoBlock.__module__}.edxval_api') |
719 | 728 | def test_export_to_xml(self, mock_val_api): |
720 | 729 | """ |
721 | 730 | Test that we write the correct XML on export. |
@@ -815,7 +824,7 @@ def test_export_to_xml_without_video_id(self): |
815 | 824 | expected = etree.XML(xml_string, parser=parser) |
816 | 825 | self.assertXmlEqual(expected, xml) |
817 | 826 |
|
818 | | - @patch('xmodule.video_block.video_block.edxval_api') |
| 827 | + @patch(f'{VideoBlock.__module__}.edxval_api') |
819 | 828 | def test_export_to_xml_val_error(self, mock_val_api): |
820 | 829 | # Export should succeed without VAL data if video does not exist |
821 | 830 | mock_val_api.ValVideoNotFoundError = _MockValVideoNotFoundError |
@@ -948,8 +957,7 @@ def test_student_view_data(self, field_data, expected_student_view_data): |
948 | 957 | 'openedx.core.djangoapps.video_config.services.VideoConfigService.is_hls_playback_enabled', |
949 | 958 | Mock(return_value=True) |
950 | 959 | ) |
951 | | - @patch('openedx.core.djangoapps.video_config.transcripts_utils.get_available_transcript_languages', |
952 | | - Mock(return_value=['es'])) |
| 960 | + @patch(get_available_transcript_languages_path, Mock(return_value=['es'])) |
953 | 961 | @patch('edxval.api.get_video_info_for_course_and_profiles', Mock(return_value={})) |
954 | 962 | @patch('openedx.core.djangoapps.video_config.transcripts_utils.get_video_transcript_content') |
955 | 963 | @patch('edxval.api.get_video_info') |
|
0 commit comments