diff --git a/lms/djangoapps/courseware/tests/test_video_handlers.py b/lms/djangoapps/courseware/tests/test_video_handlers.py index d8eeaffae933..cfbafe34b676 100644 --- a/lms/djangoapps/courseware/tests/test_video_handlers.py +++ b/lms/djangoapps/courseware/tests/test_video_handlers.py @@ -10,6 +10,7 @@ import pytest import ddt import freezegun +from django.conf import settings from django.core.files.base import ContentFile from django.utils.timezone import now from django.test import RequestFactory @@ -47,8 +48,6 @@ 00:00:00,12 --> 00:00:00,100 Привіт, edX вітає вас. """) - - def _create_srt_file(content=None): """ Create srt file in filesystem. @@ -206,10 +205,17 @@ def test_handle_ajax(self): {'demoo�': 'sample'} ] for sample in data: - response = self.clients[self.users[0].username].post( - self.get_url('save_user_state'), - sample, - HTTP_X_REQUESTED_WITH='XMLHttpRequest') + if settings.USE_EXTRACTED_VIDEO_BLOCK: + handler_url = self.get_url('save_user_state', handler_name='ajax_handler') + response = self.clients[self.users[0].username].post( + handler_url, + sample, + HTTP_X_REQUESTED_WITH='XMLHttpRequest') + else: + response = self.clients[self.users[0].username].post( + self.get_url('save_user_state'), + sample, + HTTP_X_REQUESTED_WITH='XMLHttpRequest') assert response.status_code == 200 assert self.block.speed is None diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index 98a63e394ae2..5e730312fa27 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -931,7 +931,7 @@ def helper_get_html_with_edx_video_id(self, data): # pylint: disable=invalid-name @patch('xblock.utils.resources.ResourceLoader.render_django_template', side_effect=mock_render_template) - @patch('xmodule.video_block.video_block.rewrite_video_url') + @patch(f'{VideoBlock.__module__}.rewrite_video_url') def test_get_html_cdn_source(self, mocked_get_video, mock_render_django_template): """ Test if sources got from CDN diff --git a/xmodule/modulestore/tests/test_api.py b/xmodule/modulestore/tests/test_api.py index 03dd79d4ffa4..caef59a68e16 100644 --- a/xmodule/modulestore/tests/test_api.py +++ b/xmodule/modulestore/tests/test_api.py @@ -26,7 +26,9 @@ def test_get_root_module_name(): Ensure the module name function works with different xblocks. """ assert get_root_module_name(LtiConsumerXBlock) == 'lti_consumer' - assert get_root_module_name(VideoBlock) == 'xmodule' + + expected_root_module = 'xblocks_contrib' if settings.USE_EXTRACTED_VIDEO_BLOCK else 'xmodule' + assert get_root_module_name(VideoBlock) == expected_root_module assert get_root_module_name(DoneXBlock) == 'done' diff --git a/xmodule/tests/test_video.py b/xmodule/tests/test_video.py index e6bfbc516888..94cd346272e9 100644 --- a/xmodule/tests/test_video.py +++ b/xmodule/tests/test_video.py @@ -35,7 +35,8 @@ from xmodule.tests import get_test_descriptor_system from xmodule.validation import StudioValidationMessage -from xmodule.video_block import EXPORT_IMPORT_STATIC_DIR, VideoBlock, create_youtube_string +from xmodule.video_block import EXPORT_IMPORT_STATIC_DIR, create_youtube_string +from xmodule.video_block.video_block import _BuiltInVideoBlock as VideoBlock from openedx.core.djangoapps.video_config.transcripts_utils import save_to_store from xblock.core import XBlockAside from xmodule.modulestore.tests.test_asides import AsideTestType @@ -319,7 +320,7 @@ def test_parse_xml(self): }) @XBlockAside.register_temp_plugin(AsideTestType, "test_aside") - @patch('xmodule.video_block.video_block.VideoBlock.load_file') + @patch('xmodule.video_block.video_block._BuiltInVideoBlock.load_file') @patch('xmodule.video_block.video_block.is_pointer_tag') @ddt.data(True, False) def test_parse_xml_with_asides(self, video_xml_has_aside, mock_is_pointer_tag, mock_load_file):