Skip to content

Commit

Permalink
Add check to verify supported provisioning templates (#1059)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Talreja <[email protected]>
(cherry picked from commit 08238d8)
  • Loading branch information
Gauravtalreja1 authored and web-flow committed Dec 5, 2023
1 parent 256a2e8 commit 4ff92b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
23 changes: 19 additions & 4 deletions airgun/entities/provisioning_template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from navmazing import NavigateToSibling
from widgetastic.exceptions import NoSuchElementException

from airgun.entities.base import BaseEntity
from airgun.navigation import NavigateStep, navigator
Expand Down Expand Up @@ -59,10 +60,24 @@ def unlock(self, entity_name):
def is_locked(self, entity_name):
"""Check if provisioning template is locked for editing"""
view = self.navigate_to(self, 'All')
view.search(entity_name)
return "This template is locked for editing." in view.table.row(name=entity_name)[
'Locked'
].widget.browser.element('.').get_property('innerHTML')
view.search(f'name="{entity_name}"')
try:
return "This template is locked for editing." in view.table.row(name=entity_name)[
'Locked'
].widget.browser.element('.').get_property('innerHTML')
except NoSuchElementException:
return False

def is_supported(self, entity_name):
"""Check if provisioning template is supported or not"""
view = self.navigate_to(self, 'All')
view.search(f'name="{entity_name}"')
try:
return "Supported by Red Hat" in view.table.row(name=entity_name)[
'Name'
].widget.browser.element('./img').get_attribute('title')
except NoSuchElementException:
return False

def update(self, entity_name, values):
"""Update provisioning template"""
Expand Down
2 changes: 1 addition & 1 deletion airgun/views/provisioning_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ProvisioningTemplatesView(BaseLoggedInView, SearchableViewMixinPF4):
table = Table(
'.//table',
column_widgets={
'Name': Text('./a'),
'Name': Text('.'),
'Locked': Text('.'),
'Actions': ActionsDropdown("./div[contains(@class, 'btn-group')]"),
},
Expand Down

0 comments on commit 4ff92b7

Please sign in to comment.