Skip to content

Commit

Permalink
Fix ruff issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sambible committed Oct 10, 2023
1 parent ce63985 commit 1cd34ef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
19 changes: 5 additions & 14 deletions airgun/entities/contentview_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,22 @@ def search(self, value):
return view.search(value)

def publish(self, entity_name, values=None):
"""Publishes to create new version of CV and promotes the contents to
'Library' environment.
:return: dict with new content view version table row; contains keys
like 'Version', 'Status', 'Environments' etc.
"""
"""Publishes new version of CV"""
view = self.navigate_to(self, 'Publish', entity_name=entity_name)
self.browser.plugin.ensure_page_safe(timeout='5s')
view.wait_displayed()
if values:
view.fill(values)
view.next.click()
view.finish.click()
view.progressbar.wait_for_result(delay=.01)
view.progressbar.wait_for_result(delay=0.01)
view = self.navigate_to(self, 'Edit', entity_name=entity_name)
self.browser.plugin.ensure_page_safe(timeout='5s')
view.wait_displayed()
return view.versions.table.read()

def read_french_lang_cv(self):
"""Navigates to main CV page, when system is set to French, and reads table"""
view = self.navigate_to(self, 'French')
self.browser.plugin.ensure_page_safe(timeout='5s')
view.wait_displayed()
Expand Down Expand Up @@ -91,10 +88,7 @@ def step(self, *args, **kwargs):

@navigator.register(NewContentViewEntity, 'Edit')
class EditContentView(NavigateStep):
"""Navigate to Edit Content View screen.
Args:
entity_name: name of content view
"""
"""Navigate to Edit Content View screen."""

VIEW = ContentViewEditView

Expand All @@ -109,10 +103,7 @@ def step(self, *args, **kwargs):

@navigator.register(NewContentViewEntity, 'Publish')
class PublishContentViewVersion(NavigateStep):
"""Navigate to Content View Publish screen.
Args:
entity_name: name of content view
"""
"""Navigate to Content View Publish screen."""

VIEW = ContentViewVersionPublishView

Expand Down
14 changes: 5 additions & 9 deletions airgun/views/contentview_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

LOCATION_NUM = 3


class NewAddRemoveResourcesView(View):
searchbox = PF4Search()
type = Dropdown(
Expand Down Expand Up @@ -69,14 +70,14 @@ def add(self, value):
def fill(self, values):
"""Associate resource(s)"""
if not isinstance(values, list):
values = list((values,))
values = [values]
for value in values:
self.add(value)

def remove(self, value):
"""Unassign some resource(s).
:param str or list values: string containing resource name or a list of
such strings.
such strings.
"""
self.search(value)
next(self.table.rows())[0].widget.fill(True)
Expand Down Expand Up @@ -143,9 +144,7 @@ def after_fill(self, value):
class ContentViewEditView(BaseLoggedInView):
breadcrumb = BreadCrumb('breadcrumbs-list')
search = PF4Search()
actions = ActionsDropdown(
".//button[contains(@id, 'toggle-dropdown')]"
)
actions = ActionsDropdown(".//button[contains(@id, 'toggle-dropdown')]")
publish = PF4Button('cv-details-publish-button')
dialog = ConfirmationDialog()

Expand Down Expand Up @@ -188,8 +187,7 @@ def search(self, version_name):
"""Searches for content view version.
Searchbox can't search by version name, only by number, that's why in
case version name was passed, it's transformed into recognizable
value before filling, for example::
'Version 1.0' -> 'version = 1'
value before filling, for example - Version 1.0' -> 'version = 1'
"""
search_phrase = version_name
if version_name.startswith('V') and '.' in version_name:
Expand Down Expand Up @@ -268,5 +266,3 @@ def is_displayed(self):
and self.breadcrumb.locations[0] == 'Content Views'
and self.breadcrumb.locations[2] == 'Versions'
)


2 changes: 0 additions & 2 deletions airgun/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
VerticalNavigation,
)
from widgetastic_patternfly4.ouia import BaseSelect, Button as PF4Button, Dropdown

from widgetastic_patternfly4.progress import Progress as PF4Progress

from airgun.exceptions import DisabledWidgetError, ReadOnlyWidgetError
Expand Down Expand Up @@ -2033,7 +2032,6 @@ def read(self):


class PF4ProgressBar(PF4Progress):

locator = './/div[contains(@class, "pf-c-wizard__main-body")]'

def wait_for_result(self, timeout=600, delay=1):
Expand Down

0 comments on commit 1cd34ef

Please sign in to comment.