当前位置: 首页>>代码示例>>Python>>正文


Python AdvancedSettingsPage.set_values方法代码示例

本文整理汇总了Python中common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage.set_values方法的典型用法代码示例。如果您正苦于以下问题:Python AdvancedSettingsPage.set_values方法的具体用法?Python AdvancedSettingsPage.set_values怎么用?Python AdvancedSettingsPage.set_values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage的用法示例。


在下文中一共展示了AdvancedSettingsPage.set_values方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AdvancedSettingsValidationTest

# 需要导入模块: from common.test.acceptance.pages.studio.settings_advanced import AdvancedSettingsPage [as 别名]
# 或者: from common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage import set_values [as 别名]

#.........这里部分代码省略.........
        self.set_wrong_inputs_to_fields()

        # Let modal popup
        self.advanced_settings.wait_for_modal_load()

        # Click Undo Changes button
        self.advanced_settings.undo_changes_via_modal()

        # Check that changes are undone
        for key, val in original_values_map.iteritems():
            self.assertEquals(
                self.advanced_settings.get(key),
                val,
                'Undoing Should revert back to original value'
            )

    def test_manual_change(self):
        """
        Test that manual changes button in the modal keeps settings unchanged
        """
        inputs = {"Course Display Name": 1,
                  "Advanced Module List": 1,
                  "Discussion Topic Mapping": 1,
                  "Maximum Attempts": '"string"',
                  "Course Announcement Date": '"string"',
                  }

        self.set_wrong_inputs_to_fields()
        self.advanced_settings.wait_for_modal_load()
        self.advanced_settings.trigger_manual_changes()

        # Check that the validation modal went away.
        self.assertFalse(self.advanced_settings.is_validation_modal_present())

        # Iterate through the wrong values and make sure they're still displayed
        for key, val in inputs.iteritems():
            self.assertEquals(
                str(self.advanced_settings.get(key)),
                str(val),
                'manual change should keep: ' + str(val) + ', but is: ' + str(self.advanced_settings.get(key))
            )

    def check_modal_shows_correct_contents(self, wrong_settings_list):
        """
        Helper function that checks if the validation modal contains correct
        error messages.
        """
        # Check presence of modal
        self.assertTrue(self.advanced_settings.is_validation_modal_present())

        # List of wrong settings item & what is presented in the modal should be the same
        error_item_names = self.advanced_settings.get_error_item_names()
        self.assertEqual(set(wrong_settings_list), set(error_item_names))

        error_item_messages = self.advanced_settings.get_error_item_messages()
        self.assertEqual(len(error_item_names), len(error_item_messages))

    def get_settings_fields_of_each_type(self):
        """
        Get one of each field type:
           - String: Course Display Name
           - List: Advanced Module List
           - Dict: Discussion Topic Mapping
           - Integer: Maximum Attempts
           - Date: Course Announcement Date
        """
        return {
            "Course Display Name": self.advanced_settings.get('Course Display Name'),
            "Advanced Module List": self.advanced_settings.get('Advanced Module List'),
            "Discussion Topic Mapping": self.advanced_settings.get('Discussion Topic Mapping'),
            "Maximum Attempts": self.advanced_settings.get('Maximum Attempts'),
            "Course Announcement Date": self.advanced_settings.get('Course Announcement Date'),
        }

    def set_wrong_inputs_to_fields(self):
        """
        Set wrong values for the chosen fields
        """
        self.advanced_settings.set_values(
            {
                "Course Display Name": 1,
                "Advanced Module List": 1,
                "Discussion Topic Mapping": 1,
                "Maximum Attempts": '"string"',
                "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.assertEquals(set(displayed_fields), set(expected_fields))
开发者ID:cmscom,项目名称:edx-platform,代码行数:104,代码来源:test_studio_settings.py

示例2: AdvancedSettingsValidationTest

# 需要导入模块: from common.test.acceptance.pages.studio.settings_advanced import AdvancedSettingsPage [as 别名]
# 或者: from common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage import set_values [as 别名]

#.........这里部分代码省略.........
        self.set_wrong_inputs_to_fields()

        # Let modal popup
        self.advanced_settings.wait_for_modal_load()

        # Click Undo Changes button
        self.advanced_settings.undo_changes_via_modal()

        # Check that changes are undone
        for key, val in original_values_map.iteritems():
            self.assertEquals(
                self.advanced_settings.get(key),
                val,
                'Undoing Should revert back to original value'
            )

    def test_manual_change(self):
        """
        Test that manual changes button in the modal keeps settings unchanged
        """
        inputs = {"Course Display Name": 1,
                  "Advanced Module List": 1,
                  "Discussion Topic Mapping": 1,
                  "Maximum Attempts": '"string"',
                  "Course Announcement Date": '"string"',
                  }

        self.set_wrong_inputs_to_fields()
        self.advanced_settings.wait_for_modal_load()
        self.advanced_settings.trigger_manual_changes()

        # Check that the validation modal went away.
        self.assertFalse(self.advanced_settings.is_validation_modal_present())

        # Iterate through the wrong values and make sure they're still displayed
        for key, val in inputs.iteritems():
            self.assertEquals(
                str(self.advanced_settings.get(key)),
                str(val),
                'manual change should keep: ' + str(val) + ', but is: ' + str(self.advanced_settings.get(key))
            )

    def check_modal_shows_correct_contents(self, wrong_settings_list):
        """
        Helper function that checks if the validation modal contains correct
        error messages.
        """
        # Check presence of modal
        self.assertTrue(self.advanced_settings.is_validation_modal_present())

        # List of wrong settings item & what is presented in the modal should be the same
        error_item_names = self.advanced_settings.get_error_item_names()
        self.assertEqual(set(wrong_settings_list), set(error_item_names))

        error_item_messages = self.advanced_settings.get_error_item_messages()
        self.assertEqual(len(error_item_names), len(error_item_messages))

    def get_settings_fields_of_each_type(self):
        """
        Get one of each field type:
           - String: Course Display Name
           - List: Advanced Module List
           - Dict: Discussion Topic Mapping
           - Integer: Maximum Attempts
           - Date: Course Announcement Date
        """
        return {
            "Course Display Name": self.advanced_settings.get('Course Display Name'),
            "Advanced Module List": self.advanced_settings.get('Advanced Module List'),
            "Discussion Topic Mapping": self.advanced_settings.get('Discussion Topic Mapping'),
            "Maximum Attempts": self.advanced_settings.get('Maximum Attempts'),
            "Course Announcement Date": self.advanced_settings.get('Course Announcement Date'),
        }

    def set_wrong_inputs_to_fields(self):
        """
        Set wrong values for the chosen fields
        """
        self.advanced_settings.set_values(
            {
                "Course Display Name": 1,
                "Advanced Module List": 1,
                "Discussion Topic Mapping": 1,
                "Maximum Attempts": '"string"',
                "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.assertEquals(set(displayed_fields), set(expected_fields))
开发者ID:AlexxNica,项目名称:edx-platform,代码行数:104,代码来源:test_studio_settings.py

示例3: CertificatesTest

# 需要导入模块: from common.test.acceptance.pages.studio.settings_advanced import AdvancedSettingsPage [as 别名]
# 或者: from common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage import set_values [as 别名]

#.........这里部分代码省略.........
        """
        Scenario: Ensure that creation of a certificate can be canceled correctly.
        Given I have a course without certificates
        When I click button 'Add your first Certificate'
        And I set name of certificate and click the button 'Cancel'
        Then I see that there is no certificates in the course
        """
        self.certificates_page.visit()
        self.certificates_page.click_first_certificate_button()
        certificate = self.certificates_page.certificates[0]
        certificate.course_title = "Title Override"
        certificate.click_cancel_edit_certificate()
        self.assertEqual(len(self.certificates_page.certificates), 0)

    def test_line_breaks_in_signatory_title(self):
        """
        Scenario: Ensure that line breaks are properly reflected in certificate

        Given I have a certificate with signatories
        When I add signatory title with new line character
        Then I see line break in certificate title
        """
        self.certificates_page.visit()
        certificate = self.create_and_verify_certificate(
            "Course Title Override",
            0,
            [
                {
                    'name': 'Signatory Name',
                    'title': 'Signatory title with new line character \n',
                    'organization': 'Signatory Organization',
                }
            ]
        )

        certificate.wait_for_certificate_delete_button()

        # Make sure certificate is created
        self.assertEqual(len(self.certificates_page.certificates), 1)

        signatory_title = self.certificates_page.get_first_signatory_title()
        self.assertNotEqual([], re.findall(r'<br\s*/?>', signatory_title))

    def test_course_number_in_certificate_details_view(self):
        """
        Scenario: Ensure that Course Number is displayed in certificate details view

        Given I have a certificate
        When I visit certificate details page on studio
        Then I see Course Number next to Course Name
        """
        self.certificates_page.visit()
        certificate = self.create_and_verify_certificate(
            "Course Title Override",
            0,
            [self.make_signatory_data('first')]
        )

        certificate.wait_for_certificate_delete_button()

        # Make sure certificate is created
        self.assertEqual(len(self.certificates_page.certificates), 1)
        course_number = self.certificates_page.get_course_number()
        self.assertEqual(self.course_info['number'], course_number)

    def test_course_number_override_in_certificate_details_view(self):
        """
        Scenario: Ensure that Course Number Override is displayed in certificate details view

        Given I have a certificate
        When I visit certificate details page on studio then course number override should be hidden.
        Then I visit the course advance settings page and set the value for course override number.
        Then I see Course Number Override next to Course Name in certificate settings page.
        """

        self.course_advanced_settings.update(
            {'Course Number Display String': 'Course Number Override String'}
        )

        self.certificates_page.visit()
        certificate = self.create_and_verify_certificate(
            "Course Title Override",
            0,
            [self.make_signatory_data('first')]
        )
        self.assertFalse(self.certificates_page.course_number_override().present)
        certificate.wait_for_certificate_delete_button()

        # Make sure certificate is created
        self.assertEqual(len(self.certificates_page.certificates), 1)

        # set up course number override in Advanced Settings Page
        self.advanced_settings_page.visit()
        self.advanced_settings_page.set_values(self.course_advanced_settings)
        self.advanced_settings_page.wait_for_ajax()

        self.certificates_page.visit()
        course_number_override = self.certificates_page.get_course_number_override()
        self.assertEqual(self.course_advanced_settings['Course Number Display String'], course_number_override)
        self.assertTrue(self.certificates_page.course_number_override().present)
开发者ID:cmscom,项目名称:edx-platform,代码行数:104,代码来源:test_studio_settings_certificates.py


注:本文中的common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage.set_values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。