Skip to content

Commit

Permalink
verify host name after host registration
Browse files Browse the repository at this point in the history
  • Loading branch information
amolpati30 committed May 25, 2024
1 parent 0ca9057 commit 35b204e
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/foreman/cli/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,38 @@ def test_positive_custom_facts_for_host_registration(
for interface in interfaces:
for interface_name in interface.values():
assert interface_name in str(host_info['network-interfaces'])


@pytest.mark.tier1
def test_positive_set_host_owner_correctly(
rhel8_contenthost,
module_target_sat,
module_sca_manifest_org,
module_location,
module_activation_key,
):
"""Ensures the host owner name is assigned correctly during the registration process.
:id: fa3f4e1c-e72b-4a9c-8bd6-bf47a35e9f8a
:steps:
1. Register the host.
2. Check the host is registered and verify owner name
:expectedresults: The host owner's name has been assigned correctly after registration.
:BZ: 2252768
:customerscenario: true
"""
result = rhel8_contenthost.register(
module_sca_manifest_org, module_location, module_activation_key.name, module_target_sat
)
assert result.status == 0
output = module_target_sat.execute(
f'hammer host info --name {rhel8_contenthost.hostname} | grep -i owner'
).stdout
output_in_list = output.strip().split(' Owner')
owner_name = output_in_list[0].split(':')
if owner_name[0] == 'Owner':
assert owner_name[1].strip() == 'Admin User', f'Owner is not set as {owner_name[1].strip()}'

0 comments on commit 35b204e

Please sign in to comment.