Courseware license (Creative Commons): FED
Use native checkboxes for courseware license options In Studio settings editor for video module, don't show license if feature-flagged off Don't let Scope.contents fields leak to Studio editor JS gettext() must all be on the same line for i18n Add docstrings for bok-choy tests Remove LicenseMixin from HTMLDescriptor Responding to UX review feedback Add aria-pressed attribute Use https links instead of protocol-relative links for links to creativecommons.org Remove license from course outline page in Studio
This commit is contained in:
committed by
Sarina Canelake
parent
8fbaa66d33
commit
a3887e951c
@@ -19,6 +19,13 @@ class SettingsPage(CoursePage):
|
||||
def is_browser_on_page(self):
|
||||
return self.q(css='body.view-settings').present
|
||||
|
||||
def refresh_and_wait_for_load(self):
|
||||
"""
|
||||
Refresh the page and wait for all resources to load.
|
||||
"""
|
||||
self.browser.refresh()
|
||||
self.wait_for_page()
|
||||
|
||||
def get_elements(self, css_selector):
|
||||
self.wait_for_element_presence(
|
||||
css_selector,
|
||||
@@ -72,16 +79,35 @@ class SettingsPage(CoursePage):
|
||||
'Entrance exam minimum score percent is invisible'
|
||||
)
|
||||
|
||||
def set_course_license(self, license_type):
|
||||
css_selector = (
|
||||
"section.license ul.license-types "
|
||||
"li[data-license={license_type}] button"
|
||||
).format(license_type=license_type)
|
||||
@property
|
||||
def course_license(self):
|
||||
license_types_css = "section.license ul.license-types li.license-type"
|
||||
self.wait_for_element_presence(
|
||||
css_selector,
|
||||
'{license_type} button is present'.format(license_type=license_type)
|
||||
license_types_css,
|
||||
"license type buttons are present",
|
||||
)
|
||||
self.q(css=css_selector).click()
|
||||
selected = self.q(css=license_types_css + " button.is-selected")
|
||||
if selected.is_present():
|
||||
return selected.text[0]
|
||||
return None
|
||||
|
||||
@course_license.setter
|
||||
def course_license(self, license_name):
|
||||
license_types_css = "section.license ul.license-types li.license-type"
|
||||
self.wait_for_element_presence(
|
||||
license_types_css,
|
||||
"license type buttons are present",
|
||||
)
|
||||
button_xpath = (
|
||||
"//section[contains(@class, 'license')]"
|
||||
"//ul[contains(@class, 'license-types')]"
|
||||
"//li[contains(@class, 'license-type')]"
|
||||
"//button[contains(text(),'{license_name}')]"
|
||||
).format(license_name=license_name)
|
||||
button = self.q(xpath=button_xpath)
|
||||
if not button.present:
|
||||
raise Exception("Invalid license name: {name}".format(name=license_name))
|
||||
button.click()
|
||||
|
||||
def save_changes(self, wait_for_confirmation=True):
|
||||
"""
|
||||
|
||||
@@ -424,27 +424,49 @@ class ContentLicenseTest(StudioCourseTest):
|
||||
self.browser,
|
||||
self.course_id,
|
||||
)
|
||||
self.outline_page.visit()
|
||||
self.settings_page.visit()
|
||||
|
||||
def test_empty_license(self):
|
||||
self.assertEqual(self.outline_page.license, "None")
|
||||
"""
|
||||
When I visit the Studio settings page,
|
||||
I see that the course license is "None" by default.
|
||||
Then I visit the LMS courseware page,
|
||||
and I see that there is no course license displayed.
|
||||
"""
|
||||
self.assertIsNone(self.settings_page.course_license)
|
||||
self.lms_courseware.visit()
|
||||
self.assertIsNone(self.lms_courseware.course_license)
|
||||
|
||||
def test_arr_license(self):
|
||||
self.outline_page.edit_course_start_date()
|
||||
self.settings_page.set_course_license("all-rights-reserved")
|
||||
"""
|
||||
When I visit the Studio settings page,
|
||||
and I set the course license to "All Rights Reserved",
|
||||
and I refresh the page,
|
||||
I see that the course license is "All Rights Reserved".
|
||||
Then I visit the LMS courseware page,
|
||||
and I see that the course license is "All Rights Reserved".
|
||||
"""
|
||||
self.settings_page.course_license = "All Rights Reserved"
|
||||
self.settings_page.save_changes()
|
||||
self.outline_page.visit()
|
||||
self.assertEqual(self.outline_page.license, "© All Rights Reserved")
|
||||
self.settings_page.refresh_and_wait_for_load()
|
||||
self.assertEqual(self.settings_page.course_license, "All Rights Reserved")
|
||||
|
||||
self.lms_courseware.visit()
|
||||
self.assertEqual(self.lms_courseware.course_license, "© All Rights Reserved")
|
||||
|
||||
def test_cc_license(self):
|
||||
self.outline_page.edit_course_start_date()
|
||||
self.settings_page.set_course_license("creative-commons")
|
||||
"""
|
||||
When I visit the Studio settings page,
|
||||
and I set the course license to "Creative Commons",
|
||||
and I refresh the page,
|
||||
I see that the course license is "Creative Commons".
|
||||
Then I visit the LMS courseware page,
|
||||
and I see that the course license is "Some Rights Reserved".
|
||||
"""
|
||||
self.settings_page.course_license = "Creative Commons"
|
||||
self.settings_page.save_changes()
|
||||
self.outline_page.visit()
|
||||
self.assertEqual(self.outline_page.license, "Some Rights Reserved")
|
||||
self.settings_page.refresh_and_wait_for_load()
|
||||
self.assertEqual(self.settings_page.course_license, "Creative Commons")
|
||||
|
||||
self.lms_courseware.visit()
|
||||
self.assertEqual(self.lms_courseware.course_license, "Some Rights Reserved")
|
||||
|
||||
@@ -28,6 +28,12 @@ class VideoLicenseTest(StudioCourseTest):
|
||||
|
||||
# used by StudioCourseTest.setUp()
|
||||
def populate_course_fixture(self, course_fixture):
|
||||
"""
|
||||
Create a course with a single chapter.
|
||||
That chapter has a single section.
|
||||
That section has a single vertical.
|
||||
That vertical has a single video element.
|
||||
"""
|
||||
video_block = XBlockFixtureDesc('video', "Test Video")
|
||||
vertical = XBlockFixtureDesc('vertical', "Test Vertical")
|
||||
vertical.add_children(video_block)
|
||||
@@ -38,6 +44,11 @@ class VideoLicenseTest(StudioCourseTest):
|
||||
self.course_fixture.add_children(chapter)
|
||||
|
||||
def test_empty_license(self):
|
||||
"""
|
||||
When I visit the LMS courseware,
|
||||
I can see that the video is present
|
||||
but it has no license displayed by default.
|
||||
"""
|
||||
self.lms_courseware.visit()
|
||||
video = self.lms_courseware.q(css=".vert .xblock .video")
|
||||
self.assertTrue(video.is_present())
|
||||
@@ -45,6 +56,13 @@ class VideoLicenseTest(StudioCourseTest):
|
||||
self.assertFalse(video_license.is_present())
|
||||
|
||||
def test_arr_license(self):
|
||||
"""
|
||||
When I edit a video element in Studio,
|
||||
I can set an "All Rights Reserved" license on that video element.
|
||||
When I visit the LMS courseware,
|
||||
I can see that the video is present
|
||||
and that it has "All Rights Reserved" displayed for the license.
|
||||
"""
|
||||
self.studio_course_outline.visit()
|
||||
subsection = self.studio_course_outline.section_at(0).subsection_at(0)
|
||||
subsection.expand_subsection()
|
||||
@@ -65,6 +83,13 @@ class VideoLicenseTest(StudioCourseTest):
|
||||
self.assertEqual(video_license.text[0], "© All Rights Reserved")
|
||||
|
||||
def test_cc_license(self):
|
||||
"""
|
||||
When I edit a video element in Studio,
|
||||
I can set a "Creative Commons" license on that video element.
|
||||
When I visit the LMS courseware,
|
||||
I can see that the video is present
|
||||
and that it has "Some Rights Reserved" displayed for the license.
|
||||
"""
|
||||
self.studio_course_outline.visit()
|
||||
subsection = self.studio_course_outline.section_at(0).subsection_at(0)
|
||||
subsection.expand_subsection()
|
||||
|
||||
Reference in New Issue
Block a user