From 5f2ca0ca1e924689f4e0a27d048347bccece8fa9 Mon Sep 17 00:00:00 2001 From: Peter Ondrejka Date: Fri, 5 Jan 2024 11:58:00 +0100 Subject: [PATCH] global registration with nested hostgroup --- tests/foreman/ui/test_host.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/foreman/ui/test_host.py b/tests/foreman/ui/test_host.py index d59eb3bb403..cf0fb520906 100644 --- a/tests/foreman/ui/test_host.py +++ b/tests/foreman/ui/test_host.py @@ -1208,17 +1208,19 @@ def test_global_registration_form_populate( 1. create and sync repository 2. create the content view and activation-key 3. create the host-group with activation key, operating system, host-parameters - 4. Open the global registration form and select the same host-group - 5. check host registration form should be populated automatically based on the host-group + 4. create a nested host-group to inherit values + 5. Open the global registration form and select the same host-group + 6. check host registration form should be populated automatically based on the host-group - :BZ: 2056469, 1994654 + :BZ: 2056469, 1994654, 1955421 :customerscenario: true """ hg_name = gen_string('alpha') + hg_nested_name = gen_string('alpha') iface = gen_string('alpha') group_params = {'name': 'host_packages', 'value': constants.FAKE_0_CUSTOM_PACKAGE} - target_sat.api.HostGroup( + parent_hg = target_sat.api.HostGroup( name=hg_name, organization=[module_org], lifecycle_environment=module_lce, @@ -1227,24 +1229,25 @@ def test_global_registration_form_populate( content_view=module_promoted_cv, group_parameters_attributes=[group_params], ).create() + target_sat.api.HostGroup(name=hg_nested_name, parent=parent_hg).create() new_org = target_sat.api.Organization().create() new_ak = target_sat.api.ActivationKey(organization=new_org).create() with session: session.hostgroup.update( - hg_name, + f'{hg_name}/{hg_nested_name}', { 'activation_keys.activation_keys': module_ak_with_cv.name, }, ) cmd = session.host.get_register_command( { - 'general.host_group': hg_name, + 'general.host_group': f'{hg_name}/{hg_nested_name}', 'advanced.rex_interface': iface, 'general.insecure': True, }, full_read=True, ) - assert hg_name in cmd['general']['host_group'] + assert hg_nested_name in cmd['general']['host_group'] assert module_ak_with_cv.name in cmd['general']['activation_key_helper'] assert constants.FAKE_0_CUSTOM_PACKAGE in cmd['advanced']['install_packages_helper']