本文整理汇总了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']})
示例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']})
示例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)
示例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)