From 0573c954f51fb009565dbac156ef543fd9c37a32 Mon Sep 17 00:00:00 2001 From: David Moore <109112035+damoore044@users.noreply.github.com> Date: Wed, 1 May 2024 15:00:12 -0400 Subject: [PATCH] Update fetching & search of errata ids (#1374) --- airgun/entities/contenthost.py | 8 +++++-- airgun/entities/host_new.py | 40 ++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/airgun/entities/contenthost.py b/airgun/entities/contenthost.py index 713fdc611..3886c0119 100644 --- a/airgun/entities/contenthost.py +++ b/airgun/entities/contenthost.py @@ -161,14 +161,18 @@ def install_errata(self, entity_name, errata_id, install_via='rex'): return view.read() def search_errata(self, entity_name, errata_id, environment=None): - """Search for specific errata applicable for content host. + """Search for specific errata applicable to content host. + Check the legacy Contenthost page -> Details -> Errata tab. :param str entity_name: the content hosts name. :param str errata_id: errata id or title, e.g. 'RHEA-2012:0055' :param str optional environment: lifecycle environment to filter by. """ - view = self.navigate_to(self, 'Edit', entity_name=entity_name) + view = self.navigate_to(self, 'LegacyDetails', entity_name=entity_name) + view.wait_displayed() view.errata.search(errata_id, lce=environment) + view.errata.table.wait_displayed() + self.browser.plugin.ensure_page_safe() return view.errata.table.read() def read_errata_details(self, entity_name, errata_id, environment=None): diff --git a/airgun/entities/host_new.py b/airgun/entities/host_new.py index 257b4d457..f7b8267e6 100644 --- a/airgun/entities/host_new.py +++ b/airgun/entities/host_new.py @@ -292,6 +292,46 @@ def apply_package_action(self, entity_name, package_name, action): view.flash.assert_no_error() view.flash.dismiss() + def get_errata_table( + self, + entity_name, + installable=None, + severity=None, + search=None, + type=None, + ): + """Return the table of all errata entries, from Errata tab on selected host. + param: entity_name str: hostname to search for errata table + + Optional: Filter by passing args (string): + param: installable str: filter errata by installability ('Yes' or 'No'). + param: severity str: filter errata by severity. + param: search str: pass a search query to the searchbar, prior to reading. + param: type str: filter errata search by type. + + note: all of the optional params being None, will result in no filtering. + """ + view = self.navigate_to(self, 'NewDetails', entity_name=entity_name) + view.wait_displayed() + view.content.errata.select() + # optional: filter by params that are not None + if installable is not None: + assert installable == 'Yes' or 'No', ( + 'installable_filter expected None or str, "Yes" or "No".' + f' Got: {installable}, ({type(installable)}).' + ) + view.content.errata.installable_filter.fill(installable) + if type is not None: + view.content.errata.type_filter.fill(type) + if severity is not None: + view.content.errata.severity_filter.fill(severity) + if search is not None: + view.content.errata.searchbar.fill(search) + # displayed the table with or without filters + view.content.errata.table.wait_displayed() + self.browser.plugin.ensure_page_safe() + return view.content.errata.table.read() + def get_errata_by_type(self, entity_name, type): """List errata based on type and return table""" view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)