diff --git a/tests/foreman/ui/test_errata.py b/tests/foreman/ui/test_errata.py index dadcaf6bef9..ea14057bdeb 100644 --- a/tests/foreman/ui/test_errata.py +++ b/tests/foreman/ui/test_errata.py @@ -1081,43 +1081,69 @@ 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( + 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. + 4. Search for the errata by id. Then, check the entire table without filtering. - :expectedresults: The errata from Library are displayed. + :expectedresults: The expected errata id present in Library is displayed. + Only a single errata is present, the tables match between the two pages. :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_search = session.host_new.get_errata_table( + entity_name=hostname, + search=f'errata_id="{CUSTOM_REPO_ERRATA_ID}"', + ) + # found desired errata_id by search + assert len(host_tab_search) == 1 + assert host_tab_search[0]['Errata'] == CUSTOM_REPO_ERRATA_ID + # no filters passed, checking all errata present + host_tab_erratum = session.host_new.get_errata_table(hostname) + # only the expected errata_id is found + 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 entries in chost table, only the expected one 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