From 7103280a821eeee8e1856ab62bfa4df80d796c88 Mon Sep 17 00:00:00 2001 From: David Moore Date: Tue, 21 May 2024 13:41:14 -0400 Subject: [PATCH] fixup --- tests/foreman/ui/test_errata.py | 39 +++++++++++++++------------------ 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/tests/foreman/ui/test_errata.py b/tests/foreman/ui/test_errata.py index f4db33cfbbd..b48a0c56d38 100644 --- a/tests/foreman/ui/test_errata.py +++ b/tests/foreman/ui/test_errata.py @@ -97,7 +97,7 @@ def cv_publish_promote(sat, org, cv, lce=None, needs_publish=True): :param lce: if None, default to 'Library', pass a single instance of lce, or list of instances. - do not pass the Library environment + do not pass the Library environment. :param bool needs_publish: if False, skip publish of a new version :return dictionary: 'content-view': instance of updated cv @@ -330,7 +330,7 @@ def test_end_to_end( ], 'module_stream_packages': [], } - # client was registered with no repos + # client was registered with single custom repo client = registered_contenthost hostname = client.hostname assert client.subscribed @@ -369,7 +369,7 @@ def test_end_to_end( environment=module_lce.name, ) assert len(results) == 1 - # BZ 2265095: Check all columns in table of applicable host: + # BZ 2265095: Check default columns in table of applicable host: # from ContentTypes > Errata > Details > Content Hosts tab assert results[0]['Name'] == hostname # assert str(client.deploy_rhel_version) in results[0]['OS'] @@ -529,12 +529,12 @@ def test_host_content_errata_tab_pagination( :BZ: 1662254, 1846670 """ org = module_sca_manifest_org - all_repos = module_target_sat.api.Repository(organization=org).search() - # custom_repo was created & added to cv, in registered_contenthost fixture - # search for the instance - custom_repo = [repo for repo in all_repos if repo.url == CUSTOM_REPO_3_URL] - assert len(custom_repo) > 0 - custom_repo = custom_repo[0].read() + # custom_repo was created & added to cv, enabled in registered_contenthost. + repos = [ + repo.read() for repo in module_cv.read().repository if repo.read().url == CUSTOM_REPO_3_URL + ] + assert len(repos) > 0 + custom_repo = repos[0] custom_repo.sync() # Set up rh_repo rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid( @@ -570,10 +570,8 @@ def test_host_content_errata_tab_pagination( assert registered_contenthost.execute(f'yum install -y {pkgs}').status == 0 with session: - # Go to new host's page UI, Content>Errata tab, - # read the view's pagination entitity - session.organization.select(org_name=org.name) session.location.select(loc_name=DEFAULT_LOC) + # Go to new host's page UI, Content>Errata tab, # There are two pagination objects on errata tab, we read the top one pf4_pagination = session.host_new.get_errata_pagination(_chost_name) assert pf4_pagination.read() @@ -677,18 +675,16 @@ def test_host_content_errata_tab_pagination( assert task.result == 'success' assert 'host_ids' in task.input assert registered_contenthost.nailgun_host.id in task.input['host_ids'] - # check there are no applicable errata left for Chost assert registered_contenthost.applicable_errata_count == 0 # The errata table is not present when empty, it should not be paginated. - # timeout is 30s, for tab loading with no pagination {}, on read. _items = -1 _ex_raised = False session.browser.refresh() try: wait_for( lambda: not session.host_new.get_errata_pagination(_chost_name).read(), - timeout=20, + timeout=30, delay=5, ) except NoSuchElementException: @@ -1100,7 +1096,6 @@ def test_positive_content_host_previous_env( assert vm.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0 # Promote the latest content view version to a new lifecycle environment content_view = module_cv.read() - # lce = content_view_version.environment[-1].read() new_lce = module_target_sat.api.LifecycleEnvironment( organization=module_org, prior=module_lce, @@ -1482,6 +1477,7 @@ def test_positive_filtered_errata_status_installable_param( errata_status_installable, registered_contenthost, setting_update, + module_org, target_sat, module_lce, module_cv, @@ -1527,11 +1523,12 @@ def test_positive_filtered_errata_status_installable_param( target_sat.api.ContentViewFilterRule(content_view_filter=cv_filter, errata=errata).create() module_cv = module_cv.read() # publish and promote the new version with Filter - module_cv.publish() - module_cv = module_cv.read() - module_cv.version.sort(key=lambda version: version.id) - content_view_version = module_cv.version[-1].read() - content_view_version.promote(data={'environment_ids': module_lce.id}) + cv_publish_promote( + target_sat, + module_org, + module_cv, + module_lce, + ) with session: session.location.select(loc_name=DEFAULT_LOC)