mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-22 10:19:57 +00:00
style: fix some typos and warnings
This commit is contained in:
@ -53,7 +53,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
||||
def test_run_remove(args: argparse.Namespace, configuration: Configuration, repository: Repository,
|
||||
package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must run command and remove packages afterwards
|
||||
must run command and remove packages afterward
|
||||
"""
|
||||
args = _default_args(args)
|
||||
args.remove = True
|
||||
|
@ -191,7 +191,7 @@ def test_extract_packages_by_status(application: Application, mocker: MockerFixt
|
||||
|
||||
def test_extract_packages_from_database(application: Application, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must extract packages from database from database
|
||||
must extract packages from database
|
||||
"""
|
||||
packages_mock = mocker.patch("ahriman.core.database.SQLite.packages_get")
|
||||
Rebuild.extract_packages(application, None, from_database=True)
|
||||
|
@ -5,7 +5,7 @@ from pathlib import Path
|
||||
from pytest_mock import MockerFixture
|
||||
from typing import Any
|
||||
from unittest.mock import call as MockCall
|
||||
from urllib.parse import quote_plus as urlencode
|
||||
from urllib.parse import quote_plus as url_encode
|
||||
|
||||
from ahriman.application.handlers.setup import Setup
|
||||
from ahriman.core.configuration import Configuration
|
||||
@ -148,7 +148,7 @@ def test_configuration_create_ahriman(args: argparse.Namespace, configuration: C
|
||||
MockCall("web", "port", str(args.web_port)),
|
||||
MockCall("status", "address", f"http://127.0.0.1:{str(args.web_port)}"),
|
||||
MockCall("web", "unix_socket", str(args.web_unix_socket)),
|
||||
MockCall("status", "address", f"http+unix://{urlencode(str(args.web_unix_socket))}"),
|
||||
MockCall("status", "address", f"http+unix://{url_encode(str(args.web_unix_socket))}"),
|
||||
MockCall("auth", "salt", pytest.helpers.anyvar(str, strict=True)),
|
||||
])
|
||||
write_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||
|
@ -392,7 +392,7 @@ def test_subparsers_package_status_update(parser: argparse.ArgumentParser) -> No
|
||||
|
||||
def test_subparsers_package_status_update_option_status(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
package-status-update command must convert status option to buildstatusenum instance
|
||||
package-status-update command must convert status option to BuildStatusEnum instance
|
||||
"""
|
||||
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "package-status-update"])
|
||||
assert isinstance(args.status, BuildStatusEnum)
|
||||
|
@ -115,7 +115,7 @@ def test_write_skip(lock: Lock) -> None:
|
||||
|
||||
def test_write_locked(lock: Lock, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must raise DuplicateRunError if cannot lock file
|
||||
must raise DuplicateRunError if it cannot lock file
|
||||
"""
|
||||
mocker.patch("ahriman.application.lock.Lock.perform_lock", return_value=False)
|
||||
with pytest.raises(DuplicateRunError):
|
||||
|
@ -287,6 +287,7 @@ def local_client(database: SQLite, configuration: Configuration) -> Client:
|
||||
|
||||
Args:
|
||||
database(SQLite): database fixture
|
||||
configuration(Configuration): configuration fixture
|
||||
|
||||
Returns:
|
||||
Client: local status client test instance
|
||||
|
@ -77,7 +77,7 @@ async def test_known_username(pam: PAM, user: User, mocker: MockerFixture) -> No
|
||||
|
||||
async def test_known_username_mapping(pam: PAM, user: User, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must fallback to username checking to database if no user found in system
|
||||
must fall back to username checking to database if no user found in system
|
||||
"""
|
||||
mocker.patch("ahriman.core.auth.pam.getpwnam", side_effect=KeyError)
|
||||
mapping_mock = mocker.patch("ahriman.core.auth.mapping.Mapping.known_username")
|
||||
|
@ -32,6 +32,7 @@ def test_process_build(executor: Executor, package_ahriman: Package, passwd: Any
|
||||
|
||||
executor.process_build([package_ahriman], Packagers("packager"), bump_pkgrel=False)
|
||||
init_mock.assert_called_once_with(pytest.helpers.anyvar(int), pytest.helpers.anyvar(int), None)
|
||||
changes_mock.assert_called_once_with(package_ahriman.base)
|
||||
depends_on_mock.assert_called_once_with()
|
||||
dependencies_mock.assert_called_once_with(package_ahriman.base, Dependencies())
|
||||
# must move files (once)
|
||||
|
@ -136,7 +136,7 @@ def test_event_add_failed_http_error(web_client: WebClient, mocker: MockerFixtur
|
||||
|
||||
def test_event_add_failed_suppress(web_client: WebClient, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must suppress any exception happened during events creaton and don't log
|
||||
must suppress any exception happened during events creation and don't log
|
||||
"""
|
||||
web_client.suppress_errors = True
|
||||
mocker.patch("requests.Session.request", side_effect=Exception())
|
||||
|
@ -5,7 +5,7 @@ from ahriman.models.scan_paths import ScanPaths
|
||||
|
||||
def test_is_allowed() -> None:
|
||||
"""
|
||||
must check if path is subpath of one in allowed list
|
||||
must check if path is sub-path of one in allowed list
|
||||
"""
|
||||
assert ScanPaths(["usr"]).is_allowed(Path("usr"))
|
||||
assert ScanPaths(["usr"]).is_allowed(Path("usr") / "lib")
|
||||
|
@ -252,6 +252,6 @@ async def test_username_request(base: BaseView) -> None:
|
||||
|
||||
async def test_username_request_exception(base: BaseView) -> None:
|
||||
"""
|
||||
must not fail in case if cannot read request
|
||||
must not fail in case if it cannot read request
|
||||
"""
|
||||
assert await base.username() is None
|
||||
|
Reference in New Issue
Block a user