Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions lms/djangoapps/courseware/tests/test_video_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -47,8 +48,6 @@
00:00:00,12 --> 00:00:00,100
Привіт, edX вітає вас.
""")


def _create_srt_file(content=None):
"""
Create srt file in filesystem.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/courseware/tests/test_video_mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion xmodule/modulestore/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'


Expand Down
5 changes: 3 additions & 2 deletions xmodule/tests/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
Loading