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


Python Settings.set方法代码示例

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


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

示例1: tearDownClass

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
 def tearDownClass(cls):
     super(BruteForceLogin, cls).tearDownClass()
     # reset failed_login_attempts_limit value
     sleep(301)
     Settings.set({
         u'name': u'failed_login_attempts_limit',
         u'value': cls.host_value})
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:9,代码来源:test_setting.py

示例2: test_positive_update_hostname_prefix_without_value

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_positive_update_hostname_prefix_without_value(self):
        """Update the Hostname_prefix settings without any string(empty values)

        :id: a84c28ea-6821-4c31-b4ab-8662c22c9135

        :expectedresults: Hostname_prefix should be set without any text
        """
        Settings.set({'name': "discovery_prefix", 'value': ""})
        discovery_prefix = Settings.list({
            'search': 'name=discovery_prefix'
        })[0]
        self.assertEqual('', discovery_prefix['value'])
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:14,代码来源:test_setting.py

示例3: setUp

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def setUp(self):
        """Create a directory for export, configure permissions and satellite
        settings
        """
        super(RepositoryExportTestCase, self).setUp()

        if not RepositoryExportTestCase.is_set_up:
            RepositoryExportTestCase.export_dir = gen_string('alphanumeric')

            # Create a new 'export' directory on the Satellite system
            result = ssh.command('mkdir /mnt/{0}'.format(self.export_dir))
            self.assertEqual(result.return_code, 0)

            result = ssh.command(
                'chown foreman.foreman /mnt/{0}'.format(self.export_dir))
            self.assertEqual(result.return_code, 0)

            result = ssh.command(
                'ls -Z /mnt/ | grep {0}'.format(self.export_dir))
            self.assertEqual(result.return_code, 0)
            self.assertGreaterEqual(len(result.stdout), 1)
            self.assertIn('unconfined_u:object_r:mnt_t:s0', result.stdout[0])

            # Fix SELinux policy for new directory
            result = ssh.command(
                'semanage fcontext -a -t foreman_var_run_t "/mnt/{0}(/.*)?"'
                .format(self.export_dir)
            )
            self.assertEqual(result.return_code, 0)

            result = ssh.command(
                'restorecon -Rv /mnt/{0}'.format(self.export_dir))
            self.assertEqual(result.return_code, 0)

            # Assert that we have the correct policy
            result = ssh.command(
                'ls -Z /mnt/ | grep {0}'.format(self.export_dir))
            self.assertEqual(result.return_code, 0)
            self.assertGreaterEqual(len(result.stdout), 1)
            self.assertIn(
                'unconfined_u:object_r:foreman_var_run_t:s0', result.stdout[0])

            # Update the 'pulp_export_destination' settings to new directory
            Settings.set({
                'name': 'pulp_export_destination',
                'value': '/mnt/{0}'.format(self.export_dir),
            })
            # Create an organization to reuse in tests
            RepositoryExportTestCase.org = make_org()

            RepositoryExportTestCase.is_set_up = True
开发者ID:kbidarkar,项目名称:robottelo,代码行数:53,代码来源:test_satellitesync.py

示例4: test_positive_session_preceeds_saved_credentials

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_positive_session_preceeds_saved_credentials(self):
        """Check if enabled session is mutually exclusive with
        saved credentials in hammer config

        :id: e4277298-1c24-494b-84a6-22f45f96e144

        :BZ: 1471099

        :Steps:

            1. Set use_sessions, set usernam and password,
               set short expiration time
            2. Authenticate, assert credentials are not demanded
               on next command run
            3. Wait until session expires

        :expectedresults: Session expires after specified time
            and saved credentials are not applied

        """
        try:
            idle_timeout = Settings.list({
                'search': 'name=idle_timeout'})[0][u'value']
            Settings.set({'name': 'idle_timeout', 'value': 1})
            result = configure_sessions(add_default_creds=True)
            self.assertEqual(result, 0, 'Failed to configure hammer sessions')
            Auth.login({
                'username': self.uname_admin,
                'password': self.password
            })
            result = Auth.with_user().status()
            self.assertIn(
                LOGEDIN_MSG.format(self.uname_admin),
                result[0][u'message']
            )
            # list organizations without supplying credentials
            with self.assertNotRaises(CLIReturnCodeError):
                Org.with_user().list()
            # wait until session expires
            sleep(70)
            with self.assertRaises(CLIReturnCodeError):
                Org.with_user().list()
            result = Auth.with_user().status()
            self.assertIn(
                LOGEDOFF_MSG.format(self.uname_admin),
                result[0][u'message']
            )
        finally:
            # reset timeout to default
            Settings.set({'name': 'idle_timeout', 'value': '{}'.format(
                idle_timeout)})
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:53,代码来源:test_auth.py

示例5: test_negative_update_send_welcome_email

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
def test_negative_update_send_welcome_email(value):
    """Check email send welcome email is updated

    :id: 2f75775d-72a1-4b2f-86c2-98c36e446099

    :steps: set invalid values: not booleans

    :expectedresults: send_welcome_email is not updated

    :caseautomation: automated

    :caseimportance: low
    """
    with pytest.raises(CLIReturnCodeError):
        Settings.set({'name': 'send_welcome_email', 'value': value})
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:17,代码来源:test_setting.py

示例6: test_positive_update_login_page_footer_text_without_value

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_positive_update_login_page_footer_text_without_value(self):
        """Updates parameter "login_text" without any string (empty value)

        :id: 01ce95de-2994-42b6-b9f8-f7882981fb69

        :steps:

            1. Execute "settings" command with "set" as sub-command
            without any string(empty value) in value parameter

        :expectedresults: Message on login screen should be removed
        """
        Settings.set({'name': "login_text", 'value': ""})
        login_text = Settings.list({'search': 'name=login_text'})[0]
        self.assertEqual('', login_text['value'])
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:17,代码来源:test_setting.py

示例7: test_positive_update_hostname_default_prefix

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_positive_update_hostname_default_prefix(self):
        """Update the default set prefix of hostname_prefix setting

        :id: a6e46e53-6273-406a-8009-f184d9551d66

        :expectedresults: Default set prefix should be updated with new value
        """
        hostname_prefix_value = gen_string('alpha')
        Settings.set({
            'name': "discovery_prefix",
            'value': hostname_prefix_value
        })
        discovery_prefix = Settings.list({
            'search': 'name=discovery_prefix'
        })[0]
        self.assertEqual(hostname_prefix_value, discovery_prefix['value'])
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:18,代码来源:test_setting.py

示例8: test_positive_create_session

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_positive_create_session(self):
        """Check if user stays authenticated with session enabled

        :id: fcee7f5f-1040-41a9-bf17-6d0c24a93e22

        :Steps:

            1. Set use_sessions, set short expiration time
            2. Authenticate, assert credentials are not demanded
               on next command run
            3. Wait until session expires, assert credentials
               are required

        :expectedresults: The session is successfully created and
            expires after specified time
        """
        try:
            idle_timeout = Settings.list({
                'search': 'name=idle_timeout'})[0][u'value']
            Settings.set({'name': 'idle_timeout', 'value': 1})
            result = configure_sessions()
            self.assertEqual(result, 0, 'Failed to configure hammer sessions')
            Auth.login({
                'username': self.uname_admin,
                'password': self.password
            })
            result = Auth.with_user().status()
            self.assertIn(
                LOGEDIN_MSG.format(self.uname_admin),
                result[0][u'message']
            )
            # list organizations without supplying credentials
            with self.assertNotRaises(CLIReturnCodeError):
                Org.with_user().list()
            # wait until session expires
            sleep(70)
            with self.assertRaises(CLIReturnCodeError):
                Org.with_user().list()
            result = Auth.with_user().status()
            self.assertIn(
                LOGEDOFF_MSG.format(self.uname_admin),
                result[0][u'message']
            )
        finally:
            # reset timeout to default
            Settings.set({'name': 'idle_timeout', 'value': '{}'.format(
                idle_timeout)})
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:49,代码来源:test_auth.py

示例9: test_positive_update_login_page_footer_text

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_positive_update_login_page_footer_text(self):
        """Updates parameter "login_text" in settings

        :id: 4d4e1151-5bd6-4fa2-8dbb-e182b43ad7ec

        :steps:

            1. Execute "settings" command with "set" as sub-command
            with any string

        :expectedresults: Parameter is updated successfully
        """
        for login_text_value in valid_data_list():
            with self.subTest(login_text_value):
                Settings.set({'name': "login_text", 'value': login_text_value})
                login_text = Settings.list({'search': 'name=login_text'})[0]
                self.assertEqual(login_text_value, login_text['value'])
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:19,代码来源:test_setting.py

示例10: test_positive_enable_disable_rssfeed

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_positive_enable_disable_rssfeed(self):
        """Check if the RSS feed can be enabled or disabled

        :id: 021cefab-2629-44e2-a30d-49c944d0a234

        :steps: Set rss_enable true or false

        :expectedresults: rss_enable is updated

        :caseautomation: automated
        """
        orig_value = Settings.list({'search': 'name=rss_enable'})[0]['value']
        for value in ['true', 'false']:
            Settings.set({'name': 'rss_enable', 'value': value})
            rss_setting = Settings.list({'search': 'name=rss_enable'})[0]
            self.assertEqual(value, rss_setting['value'])
        Settings.set({'name': 'rss_enable', 'value': orig_value})
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:19,代码来源:test_setting.py

示例11: test_positive_update_send_welcome_email

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_positive_update_send_welcome_email(self):
        """Check email send welcome email is updated

        :id: cdaf6cd0-5eea-4252-87c5-f9ec3ba79ac1

        :steps: valid values: boolean true or false

        :expectedresults: send_welcome_email is updated

        :caseautomation: automated

        :caseimportance: low
        """
        for value in ['true', 'false']:
            Settings.set({'name': 'send_welcome_email', 'value': value})
            host_value = Settings.list(
              {'search': 'name=send_welcome_email'})[0]['value']
            assert value == host_value
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:20,代码来源:test_setting.py

示例12: test_positive_update_login_page_footer_text_with_long_string

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_positive_update_login_page_footer_text_with_long_string(self):
        """Attempt to update parameter "Login_page_footer_text"
            with long length string under General tab

        :id: 87ef6b19-fdc5-4541-aba8-e730f1a3caa7

        :steps:
            1. Execute "settings" command with "set" as sub-command
            with long length string

        :expectedresults: Parameter is updated

        :caseimportance: low
        """
        for login_text_value in generate_strings_list(1000):
            with self.subTest(login_text_value):
                Settings.set({'name': "login_text", 'value': login_text_value})
                login_text = Settings.list({'search': 'name=login_text'})[0]
                self.assertEqual(login_text_value, login_text['value'])
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:21,代码来源:test_setting.py

示例13: test_negative_update_email_reply_address

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_negative_update_email_reply_address(self):
        """Check email reply address is not updated

        :id: 2a2220c2-badf-47d5-ba3f-e6329930ab39

        :steps: provide invalid email addresses

        :expectedresults: email_reply_address is not updated

        :caseimportance: low

        :caseautomation: automated
        """
        for email in invalid_emails_list():
            with self.subTest(email):
                with self.assertRaises(CLIReturnCodeError):
                    Settings.set({
                        'name': 'email_reply_address',
                        'value': email
                    })
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:22,代码来源:test_setting.py

示例14: test_positive_update_rssfeed_url

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_positive_update_rssfeed_url(self):
        """Check if the RSS feed URL is updated

        :id: 166ff6f2-e36e-4934-951f-b947139d0d73

        :steps:
            1. Save the original RSS URL
            2. Update RSS feed with a valid URL
            3. Assert the RSS feed URL was really updated
            4. Restore the original feed URL

        :expectedresults: RSS feed URL is updated

        :caseautomation: automated
        """
        orig_url = Settings.list({'search': 'name=rss_url'})[0]['value']
        for test_url in valid_url_list():
            Settings.set({'name': 'rss_url', 'value': test_url})
            updated_url = Settings.list({'search': 'name=rss_url'})[0]
            self.assertEqual(test_url, updated_url['value'])
        Settings.set({'name': 'rss_url', 'value': orig_url})
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:23,代码来源:test_setting.py

示例15: test_positive_failed_login_attempts_limit

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import set [as 别名]
    def test_positive_failed_login_attempts_limit(self):
        """automate brute force protection limit configurable function

         :id: f95407ed-451b-4387-ac9b-2959ae2f51ae

         :steps:
            1. Make sure login works.
            2. Save current value and set it to some lower value:
            3. Try to login with wrong password till failed_login_attempts_limit
            4. Make sure login now does not work:
            5. Wait timeout - 5 minutes + 1 second
            6. Verify you can now login fine
            7. Return the setting to previous value

         :expectedresults: failed_login_attempts_limit works as expected

         :caseautomation: automated
         """
        result = ssh.command(
            'hammer -u {0} -p {1} user list'
            .format(self.foreman_user, self.foreman_password))
        self.assertEqual(result.return_code, 0)
        Settings.set({
            u'name': u'failed_login_attempts_limit',
            u'value': '5'
        })
        for i in range(5):
            output = ssh.command(
                'hammer -u {0} -p BAD_PASS user list'.format(
                    self.foreman_user))
            self.assertEqual(output.return_code, 129)
        result = ssh.command(
            'hammer -u {0} -p {1} user list'
            .format(self.foreman_user, self.foreman_password))
        self.assertEqual(result.return_code, 129)
        sleep(301)
        result = ssh.command(
            'hammer -u {0} -p {1} user list'
            .format(self.foreman_user, self.foreman_password))
        self.assertEqual(result.return_code, 0)
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:42,代码来源:test_setting.py


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