From 00091eee4ab3facbd8ac16c145e63780c95d369b Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 15 Oct 2024 09:47:37 -0500 Subject: [PATCH 1/2] Add test for host with .ics domain name --- tests/foreman/ui/test_host.py | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/tests/foreman/ui/test_host.py b/tests/foreman/ui/test_host.py index 19c03acbc68..e58d5efff1f 100644 --- a/tests/foreman/ui/test_host.py +++ b/tests/foreman/ui/test_host.py @@ -257,6 +257,34 @@ def test_positive_read_from_details_page(session, module_host_template): assert 'Admin User' in values['properties']['properties_table']['Owner'] +def test_read_host_with_ics_domain( + session, module_host_template, module_location, module_org, target_sat +): + """Create new Host with ics domain name and verify that it can be read + + :id: 54e3db92-16c2-412b-bf68-44d479c5987b + + :expectedresults: Host ending with ics domain name can be accessed through Host UI + """ + template = module_host_template + template.name = gen_string('alpha').lower() + ics_domain = target_sat.api.Domain( + location=[module_location], + organization=[module_org], + name=gen_string('alpha').lower() + '.ics', + ).create() + template.domain = ics_domain + host = template.create() + host_name = host.name + with session: + values = session.host_new.get_details(host_name, widget_names='details') + assert ( + values['details']['system_properties']['sys_properties']['domain'] + == template.domain.name + ) + assert values['details']['system_properties']['sys_properties']['name'] == host_name + + @pytest.mark.tier4 def test_positive_read_from_edit_page(session, host_ui_options): """Create new Host and read all its content through edit page @@ -273,9 +301,6 @@ def test_positive_read_from_edit_page(session, host_ui_options): values = session.host.read(host_name) assert values['host']['name'] == host_name.partition('.')[0] assert values['host']['organization'] == api_values['host.organization'] - assert values['host']['location'] == api_values['host.location'] - assert values['host']['lce'] == ENVIRONMENT - assert values['host']['content_view'] == DEFAULT_CV assert ( values['operating_system']['architecture'] == api_values['operating_system.architecture'] From e6f07bb36a9f8abc770f7a3ad8b6cde0468e70c7 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 15 Oct 2024 10:38:50 -0500 Subject: [PATCH 2/2] address comments and update docstring --- tests/foreman/ui/test_host.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/foreman/ui/test_host.py b/tests/foreman/ui/test_host.py index e58d5efff1f..929f6b134d0 100644 --- a/tests/foreman/ui/test_host.py +++ b/tests/foreman/ui/test_host.py @@ -258,17 +258,25 @@ def test_positive_read_from_details_page(session, module_host_template): def test_read_host_with_ics_domain( - session, module_host_template, module_location, module_org, target_sat + session, module_host_template, module_location, module_org, module_target_sat ): """Create new Host with ics domain name and verify that it can be read :id: 54e3db92-16c2-412b-bf68-44d479c5987b + :steps: + 1. Create a host with a domain ending in .ics + 2. Read the host's details through the UI + :expectedresults: Host ending with ics domain name can be accessed through Host UI + + :customerscenario: true + + :Verifies: SAT-26202 """ template = module_host_template template.name = gen_string('alpha').lower() - ics_domain = target_sat.api.Domain( + ics_domain = module_target_sat.api.Domain( location=[module_location], organization=[module_org], name=gen_string('alpha').lower() + '.ics', @@ -276,7 +284,7 @@ def test_read_host_with_ics_domain( template.domain = ics_domain host = template.create() host_name = host.name - with session: + with module_target_sat.ui_session() as session: values = session.host_new.get_details(host_name, widget_names='details') assert ( values['details']['system_properties']['sys_properties']['domain']