diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index 88fb132e6b..9887c10059 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -243,14 +243,16 @@ class TestVideoPublicAccess(BaseTestVideoXBlock): @ddt.data( (True, False), (False, False), + (False, True), (True, True), ) @ddt.unpack def test_public_video_url(self, is_lms_platform, enable_public_share): """Test public video url.""" assert self.item_descriptor.public_access is True - with patch.object(self.item_descriptor, '_is_lms_platform', return_value=is_lms_platform), \ - patch.object(PUBLIC_VIDEO_SHARE, 'is_enabled', return_value=enable_public_share): + if not is_lms_platform: + self.item_descriptor.runtime.is_author_mode = True + with patch.object(PUBLIC_VIDEO_SHARE, 'is_enabled', return_value=enable_public_share): context = self.item_descriptor.render(STUDENT_VIEW).content # public video url iif PUBLIC_VIDEO_SHARE waffle and is_lms_platform, public_access are true assert bool(get_context_dict_from_string(context)['public_video_url']) \ diff --git a/xmodule/video_block/video_block.py b/xmodule/video_block/video_block.py index 1b9b441f37..772a2fbcd1 100644 --- a/xmodule/video_block/video_block.py +++ b/xmodule/video_block/video_block.py @@ -30,7 +30,6 @@ from xblock.completable import XBlockCompletionMode from xblock.core import XBlock from xblock.fields import ScopeIds from xblock.runtime import KvsFieldData -from lms.djangoapps.lms_xblock.runtime import LmsModuleSystem from common.djangoapps.xblock_django.constants import ATTR_KEY_REQUEST_COUNTRY_CODE from openedx.core.djangoapps.video_config.models import HLSPlaybackEnabledFlag, CourseYoutubeBlockedFlag @@ -481,17 +480,12 @@ class VideoBlock( return self.runtime.service(self, 'mako').render_template('video.html', template_context) - def _is_lms_platform(self): - """ - Returns True if the platform is LMS. - """ - return isinstance(self.xmodule_runtime, LmsModuleSystem) - def _get_public_video_url(self): """ Returns the public video url """ - if self.public_access and self._is_lms_platform(): + is_studio = getattr(self.runtime, "is_author_mode", False) + if self.public_access and not is_studio: from openedx.core.djangoapps.video_config.toggles import PUBLIC_VIDEO_SHARE if PUBLIC_VIDEO_SHARE.is_enabled(self.location.course_key): return urljoin(