diff --git a/tests/foreman/ui/test_errata.py b/tests/foreman/ui/test_errata.py index 2495399be13..a57ec37eacb 100644 --- a/tests/foreman/ui/test_errata.py +++ b/tests/foreman/ui/test_errata.py @@ -233,8 +233,8 @@ def registered_contenthost( Using SCA and global registration. :note: rhel_contenthost will be parameterized by rhel6 to 9, also -fips for all distros. - to use specific rhel version parameterized contenthost, use pytest.mark.rhel_ver_match() - for marking contenthost version(s) for tests using this fixture. + to use specific rhel version parameterized contenthost; + use pytest.mark.rhel_ver_match() to mark contenthost version(s) for tests using this fixture. :repos: pass as a parameterized request list of upstream URLs for custom repositories. @@ -245,7 +245,6 @@ def registered_contenthost( indirect=True, ) """ - # read indirect parameterization request, could be None try: repos = getattr(request, 'param', repos).copy() except AttributeError: @@ -726,14 +725,23 @@ def test_host_content_errata_tab_pagination( @pytest.mark.tier2 @pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url') -def test_positive_list(session, function_org_with_parameter, lce, target_sat): +def test_positive_list( + function_org_with_parameter, + module_org, + module_lce, + target_sat, + session, + lce, +): """View all errata in an Org :id: 71c7a054-a644-4c1e-b304-6bc34ea143f4 - :Setup: Errata synced on satellite server. + :Setup: + Errata from two custom repos synced on satellite server. + Each repository belonging to its own organization. - :steps: Create two Orgs each having a product synced which contains errata. + :steps: Create two Orgs each having a product and repo synced which contains errata. :expectedresults: Check that the errata belonging to one Org is not showing in the other. @@ -742,22 +750,45 @@ def test_positive_list(session, function_org_with_parameter, lce, target_sat): :customerscenario: true """ org = function_org_with_parameter - rc = target_sat.cli_factory.RepositoryCollection( - repositories=[target_sat.cli_factory.YumRepository(settings.repos.yum_3.url)] + # create and sync repository, for function org's errata + target_sat.cli_factory.setup_org_for_a_custom_repo( + { + 'url': settings.repos.yum_3.url, + 'organization-id': org.id, + 'lifecycle-environment-id': lce.id, + }, ) - rc.setup_content(org.id, lce.id) + # create and sync repository, for module org's errata + target_sat.cli_factory.setup_org_for_a_custom_repo( + { + 'url': settings.repos.yum_9.url, + 'organization-id': module_org.id, + 'lifecycle-environment-id': module_lce.id, + }, + ) + with session: + session.organization.select(org_name=module_org.name) assert ( session.errata.search(CUSTOM_REPO_ERRATA_ID, applicable=False)[0]['Errata ID'] == CUSTOM_REPO_ERRATA_ID + ), f'Could not find expected errata: {CUSTOM_REPO_ERRATA_ID}, in module org: {module_org.name}.' + + assert not session.errata.search(CUSTOM_REPO_3_ERRATA_ID, applicable=False), ( + f'Found function org ({org.name}) errata: {CUSTOM_REPO_3_ERRATA_ID},' + f' in module org ({module_org.name}) as well.' ) - assert not session.errata.search(settings.repos.yum_3.errata[5], applicable=False) + session.organization.select(org_name=org.name) assert ( - session.errata.search(settings.repos.yum_3.errata[5], applicable=False)[0]['Errata ID'] - == settings.repos.yum_3.errata[5] + session.errata.search(CUSTOM_REPO_3_ERRATA_ID, applicable=False)[0]['Errata ID'] + == CUSTOM_REPO_3_ERRATA_ID + ), f'Could not find expected errata: {CUSTOM_REPO_3_ERRATA_ID}, in function org: {org.name}.' + + assert not session.errata.search(CUSTOM_REPO_ERRATA_ID, applicable=False), ( + f'Found module org ({module_org.name}) errata: {CUSTOM_REPO_ERRATA_ID},' + f' in function org ({org.name}) as well.' ) - assert not session.errata.search(CUSTOM_REPO_ERRATA_ID, applicable=False) @pytest.mark.tier2