Move LicenseMixin into VideoFields class
This commit is contained in:
committed by
Sarina Canelake
parent
2159d34128
commit
ca2fee1259
@@ -288,7 +288,7 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
|
||||
|
||||
|
||||
class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandlers,
|
||||
TabsEditingDescriptor, LicenseMixin, EmptyDataRawDescriptor):
|
||||
TabsEditingDescriptor, EmptyDataRawDescriptor):
|
||||
"""
|
||||
Descriptor for `VideoModule`.
|
||||
"""
|
||||
|
||||
@@ -6,12 +6,13 @@ import datetime
|
||||
from xblock.fields import Scope, String, Float, Boolean, List, Dict
|
||||
|
||||
from xmodule.fields import RelativeTime
|
||||
from xmodule.mixin import LicenseMixin
|
||||
|
||||
# Make '_' a no-op so we can scrape strings
|
||||
_ = lambda text: text
|
||||
|
||||
|
||||
class VideoFields(object):
|
||||
class VideoFields(LicenseMixin):
|
||||
"""Fields for `VideoModule` and `VideoDescriptor`."""
|
||||
display_name = String(
|
||||
help=_("The name students see. This name appears in the course ribbon and as a header for the video."),
|
||||
|
||||
@@ -487,6 +487,16 @@ class XBlockWrapper(PageObject):
|
||||
"""
|
||||
type_in_codemirror(self, index, text, find_prefix='$("{}").find'.format(self.editor_selector))
|
||||
|
||||
def set_license(self, license_type):
|
||||
css_selector = (
|
||||
"ul.license-types li[data-license={license_type}] button"
|
||||
).format(license_type=license_type)
|
||||
self.wait_for_element_presence(
|
||||
css_selector,
|
||||
"{license_type} button is present".format(license_type=license_type)
|
||||
)
|
||||
self.q(css=css_selector).click()
|
||||
|
||||
def save_settings(self):
|
||||
"""
|
||||
Click on settings Save button.
|
||||
|
||||
85
common/test/acceptance/tests/video/test_video_license.py
Normal file
85
common/test/acceptance/tests/video/test_video_license.py
Normal file
@@ -0,0 +1,85 @@
|
||||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
from nose.plugins.attrib import attr
|
||||
from ..studio.base_studio_test import StudioCourseTest
|
||||
|
||||
#from ..helpers import UniqueCourseTest
|
||||
from ...pages.studio.overview import CourseOutlinePage
|
||||
from ...pages.lms.courseware import CoursewarePage
|
||||
from ...fixtures.course import XBlockFixtureDesc
|
||||
|
||||
|
||||
@attr('shard_1')
|
||||
class VideoLicenseTest(StudioCourseTest):
|
||||
|
||||
def setUp(self):
|
||||
super(VideoLicenseTest, self).setUp()
|
||||
|
||||
self.lms_courseware = CoursewarePage(
|
||||
self.browser,
|
||||
self.course_id,
|
||||
)
|
||||
self.studio_course_outline = CourseOutlinePage(
|
||||
self.browser,
|
||||
self.course_info['org'],
|
||||
self.course_info['number'],
|
||||
self.course_info['run']
|
||||
)
|
||||
|
||||
# used by StudioCourseTest.setUp()
|
||||
def populate_course_fixture(self, course_fixture):
|
||||
video_block = XBlockFixtureDesc('video', "Test Video")
|
||||
vertical = XBlockFixtureDesc('vertical', "Test Vertical")
|
||||
vertical.add_children(video_block)
|
||||
sequential = XBlockFixtureDesc('sequential', "Test Section")
|
||||
sequential.add_children(vertical)
|
||||
chapter = XBlockFixtureDesc('chapter', "Test Chapter")
|
||||
chapter.add_children(sequential)
|
||||
self.course_fixture.add_children(chapter)
|
||||
|
||||
def test_empty_license(self):
|
||||
self.lms_courseware.visit()
|
||||
video = self.lms_courseware.q(css=".vert .xblock .video")
|
||||
self.assertTrue(video.is_present())
|
||||
video_license = self.lms_courseware.q(css=".vert .xblock.xmodule_VideoModule .xblock-license")
|
||||
self.assertFalse(video_license.is_present())
|
||||
|
||||
def test_arr_license(self):
|
||||
self.studio_course_outline.visit()
|
||||
subsection = self.studio_course_outline.section_at(0).subsection_at(0)
|
||||
subsection.expand_subsection()
|
||||
unit = subsection.unit_at(0)
|
||||
container_page = unit.go_to()
|
||||
container_page.edit()
|
||||
video = [xb for xb in container_page.xblocks if xb.name == "Test Video"][0]
|
||||
video.edit().open_advanced_tab()
|
||||
video.set_license('all-rights-reserved')
|
||||
video.save_settings()
|
||||
container_page.publish_action.click()
|
||||
|
||||
self.lms_courseware.visit()
|
||||
video = self.lms_courseware.q(css=".vert .xblock .video")
|
||||
self.assertTrue(video.is_present())
|
||||
video_license = self.lms_courseware.q(css=".vert .xblock.xmodule_VideoModule .xblock-license")
|
||||
self.assertTrue(video_license.is_present())
|
||||
self.assertEqual(video_license.text[0], "© All Rights Reserved")
|
||||
|
||||
def test_cc_license(self):
|
||||
self.studio_course_outline.visit()
|
||||
subsection = self.studio_course_outline.section_at(0).subsection_at(0)
|
||||
subsection.expand_subsection()
|
||||
unit = subsection.unit_at(0)
|
||||
container_page = unit.go_to()
|
||||
container_page.edit()
|
||||
video = [xb for xb in container_page.xblocks if xb.name == "Test Video"][0]
|
||||
video.edit().open_advanced_tab()
|
||||
video.set_license('creative-commons')
|
||||
video.save_settings()
|
||||
container_page.publish_action.click()
|
||||
|
||||
self.lms_courseware.visit()
|
||||
video = self.lms_courseware.q(css=".vert .xblock .video")
|
||||
self.assertTrue(video.is_present())
|
||||
video_license = self.lms_courseware.q(css=".vert .xblock.xmodule_VideoModule .xblock-license")
|
||||
self.assertTrue(video_license.is_present())
|
||||
self.assertEqual(video_license.text[0], "Some Rights Reserved")
|
||||
Reference in New Issue
Block a user