Skip to content

Commit 3485191

Browse files
committed
chore: Fix video block test cases for extracted one
1 parent fad0bc5 commit 3485191

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

lms/djangoapps/courseware/tests/test_video_mongo.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
from xmodule.tests.helpers import mock_render_template, override_descriptor_system # pylint: disable=unused-import
5050
from xmodule.tests.test_import import DummyModuleStoreRuntime
5151
from 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
5353
from openedx.core.djangoapps.video_config.transcripts_utils import Transcript, save_to_store, subs_filename
5454
from xmodule.video_block.video_block import EXPORT_IMPORT_COURSE_DIR, EXPORT_IMPORT_STATIC_DIR
5555
from xmodule.x_module import PUBLIC_VIEW, STUDENT_VIEW
@@ -66,6 +66,15 @@
6666
from .test_video_xml import SOURCE_XML, PUBLIC_SOURCE_XML
6767
from 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+
video_block_path = 'xblocks_contrib.video.video'
73+
else:
74+
from xmodule.video_block import bumper_utils
75+
bumper_utils_path = 'xmodule.video_block.bumper_utils'
76+
video_block_path = 'xmodule.video_block.video_block'
77+
6978
TRANSCRIPT_FILE_SRT_DATA = """
7079
1
7180
00:00:14,370 --> 00:00:16,530
@@ -930,7 +939,7 @@ def helper_get_html_with_edx_video_id(self, data):
930939

931940
# pylint: disable=invalid-name
932941
@patch('xblock.utils.resources.ResourceLoader.render_django_template', side_effect=mock_render_template)
933-
@patch('xmodule.video_block.video_block.rewrite_video_url')
942+
@patch(f'{video_block_path}.rewrite_video_url')
934943
def test_get_html_cdn_source(self, mocked_get_video, mock_render_django_template):
935944
"""
936945
Test if sources got from CDN
@@ -2323,7 +2332,7 @@ class TestVideoWithBumper(TestVideo): # pylint: disable=test-inherits-tests
23232332
# Use temporary FEATURES in this test without affecting the original
23242333
FEATURES = dict(settings.FEATURES)
23252334

2326-
@patch('xmodule.video_block.bumper_utils.get_bumper_settings')
2335+
@patch(f'{bumper_utils_path}.get_bumper_settings')
23272336
def test_is_bumper_enabled(self, get_bumper_settings):
23282337
"""
23292338
Check that bumper is (not)shown if ENABLE_VIDEO_BUMPER is (False)True
@@ -2348,8 +2357,8 @@ def test_is_bumper_enabled(self, get_bumper_settings):
23482357
assert not bumper_utils.is_bumper_enabled(self.block)
23492358

23502359
@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')
2360+
@patch(f'{bumper_utils_path}.is_bumper_enabled')
2361+
@patch(f'{bumper_utils_path}.get_bumper_settings')
23532362
@patch('edxval.api.get_urls_for_profiles')
23542363
def test_bumper_metadata(
23552364
self, get_url_for_profiles, get_bumper_settings, is_bumper_enabled, mock_render_django_template

0 commit comments

Comments
 (0)