From eda1a5d7d8269cede37f4fff37aad73c609c221f Mon Sep 17 00:00:00 2001 From: David Moore Date: Tue, 30 Apr 2024 11:22:57 -0400 Subject: [PATCH] Updates for new host, and legacy chost pages --- tests/foreman/ui/test_errata.py | 65 +++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/tests/foreman/ui/test_errata.py b/tests/foreman/ui/test_errata.py index dadcaf6bef9..4ac125b593b 100644 --- a/tests/foreman/ui/test_errata.py +++ b/tests/foreman/ui/test_errata.py @@ -1081,43 +1081,60 @@ def test_positive_content_host_previous_env( @pytest.mark.tier3 -@pytest.mark.parametrize( - 'module_repos_collection_with_setup', - [ - { - 'distro': 'rhel7', - 'SatelliteToolsRepository': {}, - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'YumRepository': {'url': CUSTOM_REPO_URL}, - } - ], - indirect=True, -) -def test_positive_content_host_library(session, module_org_with_parameter, vm): - """Check if the applicable errata are available from the content - host's Library +@pytest.mark.rhel_ver_match('[8, 9]') +def test_positive_host_content_library( + module_sca_manifest_org, + registered_contenthost, + function_lce, + module_lce, + session, +): + """Check if the applicable errata are available from the content host's Library. + View errata table from within All Hosts, and legacy Contenthosts pages. :id: 4e627410-b7b8-471b-b9b4-a18e77fdd3f8 :Setup: + 1. Multiple environments are present, we will use 'Library'. + 2. A registered host's Library environment has some additional errata. - 1. Make sure multiple environments are present. - 2. Content host's Library environment has additional errata. - - :steps: Go to Content Hosts -> Select content host -> Errata Tab -> Select 'Library'. + :steps: + 1. Install the outdated package to registered host, making an errata applicable. + 2. Go to new All Hosts -> Select the host -> Content -> Errata Tab. + 3. Go to Legacy Content Hosts -> Select the host -> Errata Tab -> 'Library' env. - :expectedresults: The errata from Library are displayed. + :expectedresults: The erratum present in Library is displayed. Errata id(s) from the two pages match. :parametrized: yes """ - hostname = vm.hostname - assert vm.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0 + hostname = registered_contenthost.hostname + client = registered_contenthost + + assert client.applicable_errata_count == 0 + assert client.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0 + assert client.applicable_errata_count == 1 + assert client.applicable_package_count == 1 + with session: session.location.select(loc_name=DEFAULT_LOC) - content_host_erratum = session.contenthost.search_errata( + # check new host > host > content > errata tab: + host_tab_erratum = session.host_new.get_errata_ids(hostname) + # viewing all errata, only the expected errata is present + assert len(host_tab_erratum) == 1 + assert host_tab_erratum[0]['Errata'] == CUSTOM_REPO_ERRATA_ID + # check legacy chost > chost > errata tab -- search: + single_chost_search = session.contenthost.search_errata( hostname, CUSTOM_REPO_ERRATA_ID, environment='Library Synced Content' ) - assert content_host_erratum[0]['Id'] == CUSTOM_REPO_ERRATA_ID + # found desired errata id by search + assert len(single_chost_search) == 1 + assert single_chost_search[0]['Id'] == CUSTOM_REPO_ERRATA_ID + # display all in chost table, assert just the expected errata is present + all_chost_erratum = session.contenthost.search_errata( + hostname, errata_id=' ', environment='Library Synced Content' + ) + assert len(all_chost_erratum) == 1 + assert all_chost_erratum[0]['Id'] == CUSTOM_REPO_ERRATA_ID @pytest.mark.tier3