當前位置: 首頁>>代碼示例>>Python>>正文


Python AdvancedSettingsPage.cancel方法代碼示例

本文整理匯總了Python中common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage.cancel方法的典型用法代碼示例。如果您正苦於以下問題:Python AdvancedSettingsPage.cancel方法的具體用法?Python AdvancedSettingsPage.cancel怎麽用?Python AdvancedSettingsPage.cancel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage的用法示例。


在下文中一共展示了AdvancedSettingsPage.cancel方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: AdvancedSettingsValidationTest

# 需要導入模塊: from common.test.acceptance.pages.studio.settings_advanced import AdvancedSettingsPage [as 別名]
# 或者: from common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage import cancel [as 別名]
class AdvancedSettingsValidationTest(StudioCourseTest):
    """
    Tests for validation feature in Studio's advanced settings tab
    """
    course_name_key = 'Course Display Name'
    course_name_value = 'Test Name'

    def setUp(self):
        super(AdvancedSettingsValidationTest, self).setUp()
        self.advanced_settings = AdvancedSettingsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )

        self.type_fields = ['Course Display Name', 'Advanced Module List', 'Discussion Topic Mapping',
                            'Maximum Attempts', 'Course Announcement Date']

        # Before every test, make sure to visit the page first
        self.advanced_settings.visit()

    def test_course_author_sees_default_advanced_settings(self):
        """
        Scenario: Test that advanced settings have the default settings
            Given a staff logs in to studio
            When this user goes to advanced settings page
                Then this user sees 'Allow Anonymous Discussion Posts' as true
                And 'Enable Timed Exams' as false
                And 'Maximum Attempts' as null
        """
        anonymous_discussion_setting = self.advanced_settings.get('Allow Anonymous Discussion Posts')
        timed_exam_settings = self.advanced_settings.get('Enable Timed Exams')
        max_attempts = self.advanced_settings.get('Maximum Attempts')
        page_default_settings = [
            anonymous_discussion_setting,
            timed_exam_settings,
            max_attempts
        ]
        default_anonymous_discussion_setting = 'true'
        default_timed_exam_settings = 'false'
        default_max_attempts = 'null'
        expected_default_settings = [
            default_anonymous_discussion_setting,
            default_timed_exam_settings,
            default_max_attempts
        ]
        self.assertEqual(
            page_default_settings,
            expected_default_settings
        )

    def test_keys_appear_alphabetically(self):
        """
        Scenario: Test that advanced settings have all the keys in alphabetic order
            Given a staff logs in to studio
            When this user goes to advanced settings page
                Then he sees all the advanced setting keys in alphabetic order
        """

        key_names = self.advanced_settings.key_names
        self.assertEqual(key_names, sorted(key_names))

    def test_cancel_editing_key_value(self):
        """
        Scenario: Test that advanced settings does not save the key value, if cancel
        is clicked from notification bar
            Given a staff logs in to studio
            When this user goes to advanced settings page and enters and new course name
                Then he clicks 'cancel' buttin when asked to save changes
            When this user reloads the page
                And then he does not see any change in the original course name
        """

        original_course_display_name = self.advanced_settings.get(self.course_name_key)
        new_course_name = 'New Course Name'
        type_in_codemirror(self.advanced_settings, 16, new_course_name)
        self.advanced_settings.cancel()
        self.advanced_settings.refresh_and_wait_for_load()
        self.assertNotEqual(
            original_course_display_name,
            new_course_name,
            (
                'original course name:{} can not not be equal to unsaved course name {}'.format(
                    original_course_display_name,
                    new_course_name
                )
            )
        )
        self.assertEqual(
            self.advanced_settings.get(self.course_name_key),
            original_course_display_name,
            (
                'course name from the page should be same as original_course_display_name:{}'.format(
                    original_course_display_name
                )
            )
        )

    def test_editing_key_value(self):
#.........這裏部分代碼省略.........
開發者ID:cmscom,項目名稱:edx-platform,代碼行數:103,代碼來源:test_studio_settings.py


注:本文中的common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage.cancel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。