Commit ce5c7948 by Matt Drayer

Added field to FILTERED_LIST plus a new bokchoy test

parent dce62ed6
......@@ -15,8 +15,8 @@ class CourseMetadata(object):
editable metadata.
'''
# The list of fields that wouldn't be shown in Advanced Settings.
# Should not be used directly. Instead the filtered_list method should be used if the field needs to be filtered
# depending on the feature flag.
# Should not be used directly. Instead the filtered_list method should
# be used if the field needs to be filtered depending on the feature flag.
FILTERED_LIST = [
'xml_attributes',
'start',
......@@ -40,6 +40,8 @@ class CourseMetadata(object):
'entrance_exam_enabled',
'entrance_exam_minimum_score_pct',
'entrance_exam_id',
'is_entrance_exam',
'in_entrance_exam',
]
@classmethod
......
......@@ -13,6 +13,7 @@ MANUAL_BUTTON_SELECTOR = ".action-item .action-cancel"
MODAL_SELECTOR = ".validation-error-modal-content"
ERROR_ITEM_NAME_SELECTOR = ".error-item-title strong"
ERROR_ITEM_CONTENT_SELECTOR = ".error-item-message"
SETTINGS_NAME_SELECTOR = ".is-not-editable"
class AdvancedSettingsPage(CoursePage):
......@@ -126,3 +127,73 @@ class AdvancedSettingsPage(CoursePage):
result_map[key] = val
return result_map
@property
def displayed_settings_names(self):
"""
Returns all settings displayed on the advanced settings page/screen/modal/whatever
We call it 'name', but it's really whatever is embedded in the 'id' element for each field
"""
query = self.q(css=SETTINGS_NAME_SELECTOR)
return query.attrs('id')
@property
def expected_settings_names(self):
"""
Returns a list of settings expected to be displayed on the Advanced Settings screen
Should match the list of settings found in cms/djangoapps/models/settings/course_metadata.py
If a new setting is added to the metadata list, this test will fail and you must update it.
Basically this guards against accidental exposure of a field on the Advanced Settings screen
"""
return [
'advanced_modules',
'allow_anonymous',
'allow_anonymous_to_peers',
'allow_public_wiki_access',
'cert_name_long',
'cert_name_short',
'certificates_display_behavior',
'cohort_config',
'course_image',
'advertised_start',
'announcement',
'display_name',
'info_sidebar_name',
'is_new',
'ispublic',
'max_student_enrollments_allowed',
'no_grade',
'display_coursenumber',
'display_organization',
'end_of_course_survey_url',
'catalog_visibility',
'chrome',
'days_early_for_beta',
'default_tab',
'disable_progress_graph',
'discussion_blackouts',
'discussion_sort_alpha',
'discussion_topics',
'due',
'due_date_display_format',
'use_latex_compiler',
'video_speed_optimizations',
'enrollment_domain',
'html_textbooks',
'invitation_only',
'lti_passports',
'matlab_api_key',
'max_attempts',
'mobile_available',
'rerandomize',
'remote_gradebook',
'annotation_token_secret',
'showanswer',
'show_calculator',
'show_chat',
'show_reset_button',
'static_asset_path',
'text_customization',
'annotation_storage_url',
'video_upload_pipeline'
]
......@@ -290,3 +290,19 @@ class AdvancedSettingsValidationTest(StudioCourseTest):
"Course Announcement Date": '"string"',
}
)
def test_only_expected_fields_are_displayed(self):
"""
Scenario: The Advanced Settings screen displays settings/fields not specifically hidden from
view by a developer.
Given I have a set of CourseMetadata fields defined for the course
When I view the Advanced Settings screen for the course
The total number of fields displayed matches the number I expect
And the actual fields displayed match the fields I expect to see
"""
expected_fields = self.advanced_settings.expected_settings_names
displayed_fields = self.advanced_settings.displayed_settings_names
self.assertEqual(len(expected_fields), len(displayed_fields))
for field in displayed_fields:
if field not in expected_fields:
self.fail("Field '{}' not expected for Advanced Settings display.".format(field))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment