diff --git a/tests/foreman/cli/test_registration.py b/tests/foreman/cli/test_registration.py index 22d24ae517e..920144244ce 100644 --- a/tests/foreman/cli/test_registration.py +++ b/tests/foreman/cli/test_registration.py @@ -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()}'