diff --git a/tests/foreman/ui/test_fact.py b/tests/foreman/ui/test_fact.py index 95cad02b39..5557599630 100644 --- a/tests/foreman/ui/test_fact.py +++ b/tests/foreman/ui/test_fact.py @@ -24,34 +24,49 @@ def test_positive_upload_host_facts( module_sca_manifest_org, module_location, module_activation_key, + default_os, ): - """Verify Facts option is available on the Host UI and it is successfully updated in Satellite after registration + """Verify Facts option is available on the Host UI and it is successfully updated in Satellite after updated registration cmd :id: f32093d2-4088-4025-9623-adb3141bd770 :steps: - 1. Register host to Satellite. + 1. Register host with updated cmd to Satellite. 2. Navigate to the Host page and click on kebab. 3. Verify that the facts option is available and is updated on Satellite. - :expectedresults: Facts option is available on the Host UI and all the facts of the host are updated in Satellite. + :expectedresults: + 1. The host is successfully register using the label/name instead of the ID. + 2. Facts option is available on the Host UI and all the facts of the host are updated in Satellite. :BZ: 2001552 + :Verifies: SAT-28832 + :customerscenario: true """ + hostgroup = module_target_sat.api.HostGroup( + organization=[module_sca_manifest_org], location=[module_location] + ).create() with module_target_sat.ui_session() as session: session.organization.select(module_sca_manifest_org.name) session.location.select(module_location.name) cmd = session.host.get_register_command( { + 'general.operating_system': default_os.title, + 'general.host_group': hostgroup.name, 'general.activation_keys': module_activation_key.name, 'general.insecure': True, } ) - result = rhel_contenthost.execute(cmd) + result = cmd[cmd.find('hostgroup_id=') : cmd.find('&update_packages=')] + if ' ' in default_os.title: + default_os.title = default_os.title.replace(' ', '+') + new_data = f'hostgroup={hostgroup.name}&location={module_location.name}&operatingsystem={default_os.title}&organization={module_sca_manifest_org.name}' + updated_cmd = cmd.replace(result, new_data) + assert new_data in updated_cmd + result = rhel_contenthost.execute(updated_cmd) assert result.status == 0, f'Failed to register host: {result.stderr}' - rhel_contenthost.execute('subscription-manager facts --update') host_facts = session.host_new.get_host_facts(rhel_contenthost.hostname, fact='network') assert host_facts is not None