本文整理匯總了Python中robottelo.cli.contenthost.ContentHost類的典型用法代碼示例。如果您正苦於以下問題:Python ContentHost類的具體用法?Python ContentHost怎麽用?Python ContentHost使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ContentHost類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_positive_unregister
def test_positive_unregister(self):
"""Unregister Content host
@feature: Content host
@assert: After unregistering, Content hosts list for the org does not
show the Content host
"""
activation_key = make_activation_key({
'content-view-id': self.PROMOTED_CV['id'],
'lifecycle-environment-id': self.NEW_LIFECYCLE['id'],
'organization-id': self.NEW_ORG['id'],
})
with VirtualMachine(distro='rhel71') as client:
client.install_katello_ca()
client.register_contenthost(
activation_key['name'],
self.NEW_ORG['label'],
)
result = ContentHost.list({'organization-id': self.NEW_ORG['id']})
self.assertGreaterEqual(len(result), 1)
self.assertIn(client.hostname, [chost['name'] for chost in result])
result = client.run('subscription-manager unregister')
self.assertEqual(result.return_code, 0)
result = ContentHost.list({'organization-id': self.NEW_ORG['id']})
self.assertNotIn(
client.hostname, [chost['name'] for chost in result])
示例2: test_positive_update_1
def test_positive_update_1(self, test_data):
"""@Test: Check if content host name can be updated
@Feature: Content Hosts
@Assert: Content host is created and name is updated
"""
new_system = None
try:
new_system = make_content_host({
u'organization-id': self.NEW_ORG['id'],
u'content-view-id': self.DEFAULT_CV['id'],
u'lifecycle-environment-id': self.LIBRARY['id']})
except CLIFactoryError as err:
self.fail(err)
# Assert that name does not matches data passed
self.assertNotEqual(
new_system['name'],
test_data['name'],
"Names should not match"
)
# Update system group
result = ContentHost.update({
u'id': new_system['id'],
u'name': test_data['name']})
self.assertEqual(
result.return_code,
0,
"Content host was not updated")
self.assertEqual(
len(result.stderr), 0, "No error was expected")
# Fetch it
result = ContentHost.info({
u'id': new_system['id']})
self.assertEqual(
result.return_code,
0,
"Content host was not updated")
self.assertEqual(
len(result.stderr), 0, "No error was expected")
# Assert that name matches new value
self.assertIsNotNone(
result.stdout.get('name', None),
"The name field was not returned"
)
self.assertEqual(
result.stdout['name'],
test_data['name'],
"Names should match"
)
# Assert that name does not match original value
self.assertNotEqual(
new_system['name'],
result.stdout['name'],
"Names should not match"
)
示例3: test_positive_update_2
def test_positive_update_2(self, test_data):
"""@Test: Check if content host description can be updated
@Feature: Content Hosts
@Assert: Content host is created and description is updated
@BZ: 1082157
"""
new_system = make_content_host({
u'organization-id': self.NEW_ORG['id'],
u'content-view-id': self.DEFAULT_CV['id'],
u'lifecycle-environment-id': self.LIBRARY['id']})
# Assert that description does not match data passed
self.assertNotEqual(
new_system['description'],
test_data['description'],
"Descriptions should not match"
)
# Update sync plan
result = ContentHost.update({
u'id': new_system['id'],
u'description': test_data['description']})
self.assertEqual(
result.return_code,
0,
"Content host was not updated")
self.assertEqual(
len(result.stderr), 0, "No error was expected")
# Fetch it
result = ContentHost.info({
u'id': new_system['id']})
self.assertEqual(
result.return_code,
0,
"Content host was not updated")
self.assertEqual(
len(result.stderr), 0, "No error was expected")
# Assert that description matches new value
self.assertIsNotNone(
result.stdout.get('description', None),
"The description field was not returned"
)
self.assertEqual(
result.stdout['description'],
test_data['description'],
"Descriptions should match"
)
# Assert that description does not matches original value
self.assertNotEqual(
new_system['description'],
result.stdout['description'],
"Descriptions should not match"
)
示例4: test_positive_upgrade_packages_all
def test_positive_upgrade_packages_all(self):
"""Upgrade all the content host packages remotely
@Feature: Content Host - Package
@Assert: Packages (at least 1 with newer version available) were
successfully upgraded
"""
self.client.run("yum install -y {0}".format(FAKE_1_CUSTOM_PACKAGE))
ContentHost.package_upgrade_all(
{u"content-host": self.client.hostname, u"organization-id": KatelloAgentTestCase.org["id"]}
)
result = self.client.run("rpm -q {0}".format(FAKE_2_CUSTOM_PACKAGE))
self.assertEqual(result.return_code, 0)
示例5: test_positive_list
def test_positive_list(self):
"""List Content hosts for a given org
@id: b9c056cd-11ca-4870-bac4-0ebc4a782cb0
@Assert: Content hosts are listed for the given org
@CaseLevel: System
"""
activation_key = make_activation_key({
'content-view-id': self.PROMOTED_CV['id'],
'lifecycle-environment-id': self.NEW_LIFECYCLE['id'],
'organization-id': self.NEW_ORG['id'],
})
with VirtualMachine(distro='rhel71') as client:
client.install_katello_ca()
client.register_contenthost(
activation_key['name'],
self.NEW_ORG['label'],
)
result = ContentHost.list({
'organization-id': self.NEW_ORG['id'],
'lifecycle-environment-id': self.NEW_LIFECYCLE['id'],
})
self.assertGreaterEqual(len(result), 1)
self.assertIn(client.hostname, [chost['name'] for chost in result])
示例6: test_positive_install_package_group
def test_positive_install_package_group(self):
"""@Test: Install package group to content host remotely
@Feature: Content Host - Package group
@Assert: Package group was successfully installed
"""
ContentHost.package_group_install({
u'content-host': self.client.hostname,
u'groups': FAKE_0_CUSTOM_PACKAGE_GROUP_NAME,
u'organization-id': KatelloAgentTestCase.org['id'],
})
for package in FAKE_0_CUSTOM_PACKAGE_GROUP:
result = self.client.run('rpm -q {0}'.format(package))
self.assertEqual(result.return_code, 0)