diff --git a/robottelo/utils/datafactory.py b/robottelo/utils/datafactory.py index 7de716e1046..c227bf333ce 100644 --- a/robottelo/utils/datafactory.py +++ b/robottelo/utils/datafactory.py @@ -367,6 +367,24 @@ def valid_hostgroups_list(): ] +@filtered_datapoint +def valid_hostgroups_list_short(): + """Generates a list of valid host group names. Shorter so they can be nested. + + :return: Returns the valid host group names list + """ + return [ + gen_string('alphanumeric', random.randint(1, 15)), + gen_string('alpha', random.randint(1, 15)), + gen_string('cjk', random.randint(1, 15)), + gen_string('latin1', random.randint(1, 15)), + gen_string('numeric', random.randint(1, 15)), + gen_string('utf8', random.randint(1, 15)), + gen_string('html', random.randint(1, 15)), + gen_string('alphanumeric', random.randint(1, 15)), + ] + + @filtered_datapoint def valid_labels_list(): """Generates a list of valid labels.""" diff --git a/tests/foreman/ui/test_jobinvocation.py b/tests/foreman/ui/test_jobinvocation.py index c98e512f527..0bcdb004755 100644 --- a/tests/foreman/ui/test_jobinvocation.py +++ b/tests/foreman/ui/test_jobinvocation.py @@ -14,7 +14,10 @@ from inflection import camelize import pytest -from robottelo.utils.datafactory import gen_string +from robottelo.utils.datafactory import ( + gen_string, + valid_hostgroups_list_short, +) @pytest.fixture @@ -27,6 +30,46 @@ def module_rhel_client_by_ip(module_org, smart_proxy_location, rhel7_contenthost return rhel7_contenthost +@pytest.mark.no_containers +@pytest.mark.tier4 +def test_positive_bz2209968( + session, + module_org, + smart_proxy_location, + module_rhel_client_by_ip, + target_sat, +): + """Check that full host group names are displayed when invoking a job + + :id: 2301cd1d-ed82-4168-9f9b-d1661ac8fc5b + + :steps: + + 1. Go to Monitor -> Jobs -> Run job + 2. In "Target hosts and inputs" step, choose "Host groups" targeting + + :expectedresults: Verify that in the dropdown, full hostgroup names are present, e.g. Parent/Child/Grandchild + + :parametrized: yes + """ + names = valid_hostgroups_list_short() + parent1 = target_sat.cli_factory.hostgroup({'name': names[0]}) + parent2 = target_sat.cli_factory.hostgroup({'name': names[1]}) + child1a = target_sat.cli_factory.hostgroup({'name': names[2], 'parent': parent1['name']}) + child1b = target_sat.cli_factory.hostgroup({'name': names[3], 'parent': parent1['name']}) + target_sat.cli_factory.hostgroup({'name': names[4], 'parent': child1a['name']}) + target_sat.cli_factory.hostgroup({'name': names[5], 'parent': child1a['name']}) + target_sat.cli_factory.hostgroup({'name': names[6], 'parent': child1b['name']}) + target_sat.cli_factory.hostgroup({'name': names[7], 'parent': parent2['name']}) + + with session: + session.organization.select(module_org.name) + session.location.select(smart_proxy_location.name) + hostgroups = session.jobinvocation.read_hostgroups() + + assert 'fish' in hostgroups + + @pytest.mark.tier4 def test_positive_run_default_job_template_by_ip( session, module_org, smart_proxy_location, module_rhel_client_by_ip