4949from xmodule .tests .helpers import mock_render_template , override_descriptor_system # pylint: disable=unused-import
5050from xmodule .tests .test_import import DummyModuleStoreRuntime
5151from xmodule .tests .test_video import VideoBlockTestBase
52- from xmodule .video_block import VideoBlock , bumper_utils , video_utils
52+ from xmodule .video_block import VideoBlock , video_utils
5353from openedx .core .djangoapps .video_config .transcripts_utils import Transcript , save_to_store , subs_filename
5454from xmodule .video_block .video_block import EXPORT_IMPORT_COURSE_DIR , EXPORT_IMPORT_STATIC_DIR
5555from xmodule .x_module import PUBLIC_VIEW , STUDENT_VIEW
6666from .test_video_xml import SOURCE_XML , PUBLIC_SOURCE_XML
6767from common .test .utils import assert_dict_contains_subset
6868
69+ if settings .USE_EXTRACTED_VIDEO_BLOCK :
70+ from xblocks_contrib .video import bumper_utils
71+ bumper_utils_path = 'xblocks_contrib.video.bumper_utils'
72+ else :
73+ from xmodule .video_block import bumper_utils
74+ bumper_utils_path = 'xmodule.video_block.bumper_utils'
75+
6976TRANSCRIPT_FILE_SRT_DATA = """
70771
717800:00:14,370 --> 00:00:16,530
@@ -930,7 +937,7 @@ def helper_get_html_with_edx_video_id(self, data):
930937
931938 # pylint: disable=invalid-name
932939 @patch ('xblock.utils.resources.ResourceLoader.render_django_template' , side_effect = mock_render_template )
933- @patch ('xmodule.video_block.video_block .rewrite_video_url' )
940+ @patch (f' { VideoBlock . __module__ } .rewrite_video_url' )
934941 def test_get_html_cdn_source (self , mocked_get_video , mock_render_django_template ):
935942 """
936943 Test if sources got from CDN
@@ -2323,7 +2330,7 @@ class TestVideoWithBumper(TestVideo): # pylint: disable=test-inherits-tests
23232330 # Use temporary FEATURES in this test without affecting the original
23242331 FEATURES = dict (settings .FEATURES )
23252332
2326- @patch ('xmodule.video_block.bumper_utils .get_bumper_settings' )
2333+ @patch (f' { bumper_utils_path } .get_bumper_settings' )
23272334 def test_is_bumper_enabled (self , get_bumper_settings ):
23282335 """
23292336 Check that bumper is (not)shown if ENABLE_VIDEO_BUMPER is (False)True
@@ -2348,8 +2355,8 @@ def test_is_bumper_enabled(self, get_bumper_settings):
23482355 assert not bumper_utils .is_bumper_enabled (self .block )
23492356
23502357 @patch ('xblock.utils.resources.ResourceLoader.render_django_template' , side_effect = mock_render_template )
2351- @patch ('xmodule.video_block.bumper_utils .is_bumper_enabled' )
2352- @patch ('xmodule.video_block.bumper_utils .get_bumper_settings' )
2358+ @patch (f' { bumper_utils_path } .is_bumper_enabled' )
2359+ @patch (f' { bumper_utils_path } .get_bumper_settings' )
23532360 @patch ('edxval.api.get_urls_for_profiles' )
23542361 def test_bumper_metadata (
23552362 self , get_url_for_profiles , get_bumper_settings , is_bumper_enabled , mock_render_django_template
0 commit comments