Skip to content

Commit

Permalink
[6.13.z] host edit: test correct page redirection (SatelliteQE#14918)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnovotny authored Apr 30, 2024
1 parent a76db69 commit 9c87267
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pytest_fixtures/component/taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ def default_location(session_target_sat):
def current_sat_org(target_sat):
"""Return the current organization assigned to the Satellite host"""
sat_host = target_sat.api.Host().search(query={'search': f'name={target_sat.hostname}'})[0]
return sat_host.organization.read().name
return sat_host.organization.read()


@pytest.fixture
def current_sat_location(target_sat):
"""Return the current location assigned to the Satellite host"""
sat_host = target_sat.api.Host().search(query={'search': f'name={target_sat.hostname}'})[0]
return sat_host.location.read().name
return sat_host.location.read()


@pytest.fixture
Expand Down
34 changes: 30 additions & 4 deletions tests/foreman/ui/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,8 @@ def test_positive_manage_table_columns(session, current_sat_org, current_sat_loc
'Recommendations': False,
}
with session:
session.organization.select(org_name=current_sat_org)
session.location.select(loc_name=current_sat_location)
session.organization.select(org_name=current_sat_org.name)
session.location.select(loc_name=current_sat_location.name)
session.host.manage_table_columns(columns)
displayed_columns = session.host.get_displayed_table_headers()
for column, is_displayed in columns.items():
Expand Down Expand Up @@ -1128,8 +1128,8 @@ def test_positive_host_details_read_templates(
host = target_sat.api.Host().search(query={'search': f'name={target_sat.hostname}'})[0]
api_templates = [template['name'] for template in host.list_provisioning_templates()]
with session:
session.organization.select(org_name=current_sat_org)
session.location.select(loc_name=current_sat_location)
session.organization.select(org_name=current_sat_org.name)
session.location.select(loc_name=current_sat_location.name)
host_detail = session.host_new.get_details(target_sat.hostname, widget_names='details')
ui_templates = [
row['column1'].strip()
Expand Down Expand Up @@ -1714,3 +1714,29 @@ def test_positive_tracer_enable_reload(tracer_install_host, target_sat):
)
tracer = session.host_new.get_tracer(tracer_install_host.hostname)
assert tracer['title'] == "No applications to restart"


@pytest.mark.tier3
@pytest.mark.rhel_ver_match('8')
def test_positive_page_redirect_after_update(target_sat, current_sat_location):
"""Check that page redirects correctly after editing a host without making any changes.
:id: 29c3397e-0010-11ef-bca4-000c2989e153
:steps:
1. Go to All Hosts page.
2. Edit a host. Using the Sat. host is sufficient, no other host needs to be created or registered,
because we need just a host with FQDN.
3. Submit the host edit dialog without making any changes.
:expectedresults: The page should be redirected to the host details page.
:BZ: 2166303
"""
client = target_sat
with target_sat.ui_session() as session:
session.location.select(loc_name=current_sat_location.name)
session.host_new.update(client.hostname, {})

assert 'page-not-found' not in session.browser.url
assert client.hostname in session.browser.url

0 comments on commit 9c87267

Please sign in to comment.