Skip to content

Commit

Permalink
host edit: test correct page redirection (SatelliteQE#14844)
Browse files Browse the repository at this point in the history
hosts: test correct page redirect after host edit

Component evaluation - SAT-21625
https://bugzilla.redhat.com/2166303

Check that after editing a host without making any changes(*),
the page is correctly redirected to the host details page.

(*) Making or not making any changes in the edit dialog
actually does not matter.

(cherry picked from commit de93ea2)

+ Backported changes from SatelliteQE#14247
for fixtures `current_sat_location` & `current_sat_org`.
  • Loading branch information
pnovotny committed Apr 29, 2024
1 parent 6d4f623 commit 4b498ff
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 @@ -1078,8 +1078,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 @@ -1110,8 +1110,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 @@ -1891,3 +1891,29 @@ def test_change_content_source(session, change_content_source_prep, rhel_content
rhel_contenthost_post_values['lifecycle_environment']['name']
== rhel_contenthost_post_values['lifecycle_environment']['name']
)


@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 4b498ff

Please sign in to comment.