Files
galaxy/lib/tool_shed/test/base/browser.py
T
Nicola Soranzo 7f89e0eab9 Code cleanups from pyupgrade
Found by running:

```
make pyupgrade
ruff check --fix .
ruff check --preview --unsafe-fixes --select=F401 --fix .
make format
make update-client-api-schema
```

The bulk of the changes are replacements of typing deprecated aliases
such as `Dict` and `List` with the standard library classes. These
aliases became redundant in Python 3.9 when the corresponding
pre-existing classes were enhanced to support `[]`, see
https://docs.python.org/3/library/typing.html#deprecated-aliases

Also:
- Update the `pyupgrade` Makefile target to use `--py38-plus` for the
  packages needed by Pulsar, including the new galaxy-tool-util-models
  package.
2025-07-31 11:17:22 +01:00

50 lines
1.5 KiB
Python

import abc
from typing import (
Union,
)
FormValueType = Union[str, bool]
class ShedBrowser(metaclass=abc.ABCMeta):
@abc.abstractmethod
def visit_url(self, url: str, allowed_codes: list[int]) -> str:
"""Navigate to the supplied URL."""
@abc.abstractmethod
def page_content(self) -> str:
"""Return the page content for"""
@abc.abstractmethod
def check_page_for_string(self, patt: str) -> None:
"""Looks for 'patt' in the current browser page"""
@abc.abstractmethod
def check_string_not_in_page(self, patt: str) -> None:
"""Looks for 'patt' not being in the current browser page"""
@abc.abstractmethod
def fill_form_value(self, form_name: str, control_name: str, value: FormValueType):
"""Fill in a form value."""
@abc.abstractmethod
def submit_form(self, form_no=-1, button="runtool_btn", form=None, **kwd):
"""Submit the target button."""
@abc.abstractmethod
def submit_form_with_name(self, form_name: str, button="runtool_btn", **kwd):
"""Submit the target button."""
@property
@abc.abstractmethod
def is_twill(self) -> bool:
"""Return whether this is a twill browser."""
@abc.abstractmethod
def edit_repository_categories(self, categories_to_add: list[str], categories_to_remove: list[str]) -> None:
"""Select some new categories and then restore the component."""
@abc.abstractmethod
def grant_users_access(self, usernames: list[str]) -> None:
"""Select users to grant access to."""