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


Python DiscoveryRule.with_user方法代码示例

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


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

示例1: test_negative_delete_rule_with_non_admin_user

# 需要导入模块: from robottelo.cli.discoveryrule import DiscoveryRule [as 别名]
# 或者: from robottelo.cli.discoveryrule.DiscoveryRule import with_user [as 别名]
    def test_negative_delete_rule_with_non_admin_user(self):
        """Delete rule with non-admin user by associating discovery_reader role

        :id: f7f9569b-916e-46f3-bd89-a05e33483741

        :expectedresults: User should validation error and rule should not be
            deleted successfully.

        :CaseLevel: Integration
        """
        rule = make_discoveryrule({
            u'enabled': 'false',
            u'search': "last_report = Today",
            u'organization-ids': self.org['id'],
            u'location-ids': self.loc['id'],
            u'hostgroup-id': self.hostgroup['id'],
        })
        rule = DiscoveryRule.with_user(
            self.user_reader['login'],
            self.user_reader['password']
        ).info({u'id': rule['id']})
        with self.assertRaises(CLIReturnCodeError):
            DiscoveryRule.with_user(
                self.user_reader['login'],
                self.user_reader['password']
            ).delete({u'id': rule['id']})
开发者ID:kbidarkar,项目名称:robottelo,代码行数:28,代码来源:test_discoveryrule.py

示例2: test_positive_delete_rule_with_non_admin_user

# 需要导入模块: from robottelo.cli.discoveryrule import DiscoveryRule [as 别名]
# 或者: from robottelo.cli.discoveryrule.DiscoveryRule import with_user [as 别名]
    def test_positive_delete_rule_with_non_admin_user(self):
        """Delete rule with non-admin user by associating discovery_manager role

        :id: 87ab969b-7d92-478d-a5c0-1c0d50e9bdd6

        :expectedresults: Rule should be deleted successfully.

        :CaseLevel: Integration
        """
        rule_name = gen_string('alpha')
        rule = DiscoveryRule.with_user(
            self.user['login'],
            self.user['password']
        ).create({
            u'name': rule_name,
            u'search': 'cpu_count = 5',
            u'organization-ids': self.org['id'],
            u'location-ids': self.loc['id'],
            u'hostgroup-id': self.hostgroup['id'],
        })
        rule = DiscoveryRule.with_user(
            self.user['login'],
            self.user['password']
        ).info({u'id': rule['id']})
        DiscoveryRule.with_user(
            self.user['login'],
            self.user['password'],
        ).delete({u'id': rule['id']})
        with self.assertRaises(CLIReturnCodeError):
            DiscoveryRule.info({u'id': rule['id']})
开发者ID:kbidarkar,项目名称:robottelo,代码行数:32,代码来源:test_discoveryrule.py

示例3: test_positive_create_rule_with_non_admin_user

# 需要导入模块: from robottelo.cli.discoveryrule import DiscoveryRule [as 别名]
# 或者: from robottelo.cli.discoveryrule.DiscoveryRule import with_user [as 别名]
    def test_positive_create_rule_with_non_admin_user(self):
        """Create rule with non-admin user by associating discovery_manager role

        :id: 056535aa-3338-4c1e-8a4b-ebfc8bd6e456

        :expectedresults: Rule should be created successfully.

        :CaseLevel: Integration
        """
        rule_name = gen_string('alpha')
        rule = DiscoveryRule.with_user(
            self.user['login'],
            self.user['password']
        ).create({
            u'name': rule_name,
            u'search': 'cpu_count = 5',
            u'organization-ids': self.org['id'],
            u'location-ids': self.loc['id'],
            u'hostgroup-id': self.hostgroup['id'],
        })
        rule = DiscoveryRule.with_user(
            self.user['login'],
            self.user['password']
        ).info({u'id': rule['id']})
        self.assertEqual(rule['name'], rule_name)
开发者ID:kbidarkar,项目名称:robottelo,代码行数:27,代码来源:test_discoveryrule.py

示例4: test_positive_view_existing_rule_with_non_admin_user

# 需要导入模块: from robottelo.cli.discoveryrule import DiscoveryRule [as 别名]
# 或者: from robottelo.cli.discoveryrule.DiscoveryRule import with_user [as 别名]
    def test_positive_view_existing_rule_with_non_admin_user(self):
        """Existing rule should be viewed to non-admin user by associating
        discovery_reader role.

        :id: 7b1d90b9-fc2d-4ccb-93d3-605c2da876f7

        :Steps:

            1. create a rule with admin user
            2. create a non-admin user and assign 'Discovery Reader' role
            3. Login with non-admin user

        :expectedresults: Rule should be visible to non-admin user.

        :CaseLevel: Integration
        """
        rule_name = gen_string('alpha')
        rule = make_discoveryrule({
            u'name': rule_name,
            u'enabled': 'false',
            u'search': "last_report = Today",
            u'organization-ids': self.org['id'],
            u'location-ids': self.loc['id'],
            u'hostgroup-id': self.hostgroup['id'],
        })
        rule = DiscoveryRule.with_user(
            self.user_reader['login'],
            self.user_reader['password']
        ).info({u'id': rule['id']})
        self.assertEqual(rule['name'], rule_name)
开发者ID:kbidarkar,项目名称:robottelo,代码行数:32,代码来源:test_discoveryrule.py


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