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


Python Settings.list方法代码示例

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


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

示例1: setUpClass

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [as 别名]
    def setUpClass(cls):
        """Steps to Configure foreman discovery

        1. Build PXE default template
        2. Create Organization/Location
        3. Update Global parameters to set default org and location for
           discovered hosts.
        4. Enable auto_provision flag to perform discovery via discovery
           rules.
        """
        super(DiscoveredTestCase, cls).setUpClass()

        # Build PXE default template to get default PXE file
        Template.build_pxe_default()
        # let's just modify the timeouts to speed things up
        ssh.command("sed -ie 's/TIMEOUT [[:digit:]]\\+/TIMEOUT 1/g' "
                    "/var/lib/tftpboot/pxelinux.cfg/default")
        ssh.command("sed -ie '/APPEND initrd/s/$/ fdi.countdown=1/' "
                    "/var/lib/tftpboot/pxelinux.cfg/default")

        # Create Org and location
        cls.org = make_org()
        cls.loc = make_location()

        # Get default settings values
        cls.default_discovery_loc = Settings.list(
            {'search': 'name=%s' % 'discovery_location'})[0]
        cls.default_discovery_org = Settings.list(
            {'search': 'name=%s' % 'discovery_organization'})[0]
        cls.default_discovery_auto = Settings.list(
            {'search': 'name=%s' % 'discovery_auto'})[0]

        # Update default org and location params to place discovered host
        Settings.set({'name': 'discovery_location', 'value': cls.loc['name']})
        Settings.set(
            {'name': 'discovery_organization', 'value': cls.org['name']})

        # Enable flag to auto provision discovered hosts via discovery rules
        Settings.set({'name': 'discovery_auto', 'value': 'true'})

        # Flag which shows whether environment is fully configured for
        # discovered host provisioning.
        cls.configured_env = False

        if bz_bug_is_open(1578290):
            ssh.command('mkdir /var/lib/tftpboot/boot/fdi-image')
            ssh.command('ln -s /var/lib/tftpboot/boot/'
                        'foreman-discovery-image-3.4.4-1.iso-vmlinuz'
                        ' /var/lib/tftpboot/boot/fdi-image/vmlinuz0')
            ssh.command('ln -s /var/lib/tftpboot/boot/'
                        'foreman-discovery-image-3.4.4-1.iso-img'
                        ' /var/lib/tftpboot/boot/fdi-image/initrd0.img')
            ssh.command('chown -R foreman-proxy /var/lib/tftpboot/boot/')
开发者ID:pondrejk,项目名称:robottelo,代码行数:55,代码来源:test_discoveredhost.py

示例2: test_positive_enable_disable_rssfeed

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [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

示例3: test_positive_update_rssfeed_url

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [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

示例4: test_positive_update_hostname_prefix_without_value

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [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

示例5: test_positive_create_with_default_download_policy

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [as 别名]
    def test_positive_create_with_default_download_policy(self):
        """Verify if the default download policy is assigned
        when creating a YUM repo without `--download-policy`

        @id: 9a3c4d95-d6ca-4377-9873-2c552b7d6ce7

        @Assert: YUM repository with a default download policy
        """
        default_dl_policy = Settings.list({"search": "name=default_download_policy"})
        self.assertTrue(default_dl_policy)
        new_repo = self._make_repository({u"content-type": u"yum"})
        self.assertEqual(new_repo["download-policy"], default_dl_policy[0]["value"])
开发者ID:SatelliteQE,项目名称:robottelo,代码行数:14,代码来源:test_repository.py

示例6: test_positive_session_preceeds_saved_credentials

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [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

示例7: setUpClass

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [as 别名]
    def setUpClass(cls):
        """Steps to Configure foreman discovery

        1. Build PXE default template
        2. Create Organization/Location
        3. Update Global parameters to set default org and location for
           discovered hosts.
        4. Enable auto_provision flag to perform discovery via discovery
           rules.
        """
        super(DiscoveredTestCase, cls).setUpClass()

        # Build PXE default template to get default PXE file
        Template.build_pxe_default()

        # Create Org and location
        cls.org = make_org()
        cls.loc = make_location()

        # Get default settings values
        cls.default_discovery_loc = Settings.list(
            {'search': 'name=%s' % 'discovery_location'})[0]
        cls.default_discovery_org = Settings.list(
            {'search': 'name=%s' % 'discovery_organization'})[0]
        cls.default_discovery_auto = Settings.list(
            {'search': 'name=%s' % 'discovery_auto'})[0]

        # Update default org and location params to place discovered host
        Settings.set({'name': 'discovery_location', 'value': cls.loc['name']})
        Settings.set(
            {'name': 'discovery_organization', 'value': cls.org['name']})

        # Enable flag to auto provision discovered hosts via discovery rules
        Settings.set({'name': 'discovery_auto', 'value': 'true'})

        # Flag which shows whether environment is fully configured for
        # discovered host provisioning.
        cls.configured_env = False
开发者ID:SatelliteQE,项目名称:robottelo,代码行数:40,代码来源:test_discoveredhost.py

示例8: test_positive_update_login_page_footer_text_without_value

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [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

示例9: test_positive_update_hostname_default_prefix

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [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

示例10: test_positive_create_session

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [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

示例11: test_positive_update_login_page_footer_text

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [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

示例12: test_positive_update_send_welcome_email

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [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

示例13: test_positive_update_login_page_footer_text_with_long_string

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [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

示例14: test_positive_update_email_subject_prefix

# 需要导入模块: from robottelo.cli.settings import Settings [as 别名]
# 或者: from robottelo.cli.settings.Settings import list [as 别名]
    def test_positive_update_email_subject_prefix(self):
        """Check email subject prefix is updated

        :id: c8e6b323-7b39-43d6-a9f1-5474f920bba2

        :expectedresults: email_subject_prefix is updated

        :caseautomation: automated

        :caseimportance: low
        """
        email_subject_prefix_value = gen_string('alpha')
        Settings.set({
            'name': "email_subject_prefix",
            'value': email_subject_prefix_value
        })
        email_subject_prefix = Settings.list({
            'search': 'name=email_subject_prefix'
        })[0]
        self.assertEqual(
            email_subject_prefix_value,
            email_subject_prefix['value']
        )
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:25,代码来源:test_setting.py

示例15: test_positive_update_email_reply_address

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

        :id: cb0907d1-9cb6-45c4-b2bb-e2790ea55f16

        :expectedresults: email_reply_address is updated

        :caseimportance: low

        :caseautomation: automated
        """
        for email in valid_emails_list():
            with self.subTest(email):
                # The email must be escaped because some characters to not fail
                # the parsing of the generated shell command
                escaped_email = email.replace(
                    '"', r'\"').replace('`', r'\`')
                Settings.set({
                    'name': "email_reply_address",
                    'value': escaped_email})
                email_reply_address = Settings.list({
                    'search': 'name=email_reply_address'
                }, output_format='json')[0]
                self.assertEqual(email_reply_address['value'], email)
开发者ID:JacobCallahan,项目名称:robottelo,代码行数:26,代码来源:test_setting.py


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