fix descriptions

This commit is contained in:
2022-04-06 01:48:03 +03:00
parent 8f18ead4cc
commit 4990ce4198
20 changed files with 55 additions and 38 deletions

View File

@ -21,7 +21,7 @@ def test_finalize(application_packages: Packages) -> None:
def test_known_packages(application_packages: Packages) -> None:
"""
must raise NotImplemented for missing finalize method
must raise NotImplemented for missing known_packages method
"""
with pytest.raises(NotImplementedError):
application_packages._known_packages()
@ -42,17 +42,17 @@ def test_add_aur(application_packages: Packages, package_ahriman: Package, mocke
must add package from AUR
"""
mocker.patch("ahriman.models.package.Package.load", return_value=package_ahriman)
insert_mock = mocker.patch("ahriman.core.database.sqlite.SQLite.build_queue_insert")
load_mock = mocker.patch("ahriman.core.build_tools.sources.Sources.load")
dependencies_mock = mocker.patch("ahriman.application.application.packages.Packages._process_dependencies")
build_queue_mock = mocker.patch("ahriman.core.database.sqlite.SQLite.build_queue_insert")
application_packages._add_aur(package_ahriman.base, set(), False)
insert_mock.assert_called_once_with(package_ahriman)
load_mock.assert_called_once_with(
pytest.helpers.anyvar(int),
package_ahriman.git_url,
pytest.helpers.anyvar(int))
dependencies_mock.assert_called_once_with(pytest.helpers.anyvar(int), set(), False)
build_queue_mock.assert_called_once_with(package_ahriman)
def test_add_directory(application_packages: Packages, package_ahriman: Package, mocker: MockerFixture) -> None:
@ -75,16 +75,16 @@ def test_add_local(application_packages: Packages, package_ahriman: Package, moc
"""
mocker.patch("ahriman.models.package.Package.load", return_value=package_ahriman)
init_mock = mocker.patch("ahriman.core.build_tools.sources.Sources.init")
insert_mock = mocker.patch("ahriman.core.database.sqlite.SQLite.build_queue_insert")
copytree_mock = mocker.patch("shutil.copytree")
dependencies_mock = mocker.patch("ahriman.application.application.packages.Packages._process_dependencies")
build_queue_mock = mocker.patch("ahriman.core.database.sqlite.SQLite.build_queue_insert")
application_packages._add_local(package_ahriman.base, set(), False)
copytree_mock.assert_called_once_with(
Path(package_ahriman.base), application_packages.repository.paths.cache_for(package_ahriman.base))
init_mock.assert_called_once_with(application_packages.repository.paths.cache_for(package_ahriman.base))
insert_mock.assert_called_once_with(package_ahriman)
dependencies_mock.assert_called_once_with(pytest.helpers.anyvar(int), set(), False)
build_queue_mock.assert_called_once_with(package_ahriman)
def test_add_remote(application_packages: Packages, package_description_ahriman: PackageDescription,

View File

@ -41,7 +41,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, aur_package
def test_run_empty_exception(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
"""
must run command
must raise ExitCode exception on empty result list
"""
args = _default_args(args)
args.exit_code = True

View File

@ -62,7 +62,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
def test_run_verbose(args: argparse.Namespace, configuration: Configuration, package_ahriman: Package,
mocker: MockerFixture) -> None:
"""
must run command
must run command with detailed info
"""
args = _default_args(args)
args.info = True

View File

@ -59,7 +59,7 @@ def test_check_unsafe() -> None:
def test_check_unsafe_safe() -> None:
"""
must check if command is unsafe
must check if command is safe
"""
UnsafeCommands.check_unsafe("package-status", ["repo-clean"], _parser())

View File

@ -34,7 +34,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
def test_disallow_auto_architecture_run() -> None:
"""
must not allow multi architecture run
must not allow auto architecture run
"""
assert not Web.ALLOW_AUTO_ARCHITECTURE_RUN

View File

@ -264,9 +264,7 @@ def repository_paths(configuration: Configuration) -> RepositoryPaths:
:param configuration: configuration fixture
:return: repository paths test instance
"""
return RepositoryPaths(
architecture="x86_64",
root=configuration.getpath("repository", "root"))
return configuration.repository_paths
@pytest.fixture

View File

@ -13,10 +13,12 @@ def test_migrate_data_initial(connection: Connection, configuration: Configurati
must perform initial migration
"""
packages = mocker.patch("ahriman.core.database.data.migrate_package_statuses")
patches = mocker.patch("ahriman.core.database.data.migrate_patches")
users = mocker.patch("ahriman.core.database.data.migrate_users_data")
migrate_data(MigrationResult(old_version=0, new_version=900), connection, configuration, repository_paths)
packages.assert_called_once_with(connection, repository_paths)
patches.assert_called_once_with(connection, repository_paths)
users.assert_called_once_with(connection, configuration)

View File

@ -21,7 +21,7 @@ def test_sign_ascii(package_ahriman: Package) -> None:
def test_sign_utf8(package_ahriman: Package) -> None:
"""
must correctly generate sign in ascii
must correctly generate sign in utf8
"""
with pytest.raises(UnicodeEncodeError):
BuildPrinter(package_ahriman, is_success=True, use_utf=True).title().encode("ascii")
@ -31,6 +31,6 @@ def test_sign_utf8(package_ahriman: Package) -> None:
def test_title(package_ahriman: Package) -> None:
"""
must return non empty title
must return non-empty title
"""
assert BuildPrinter(package_ahriman, is_success=True, use_utf=False).title() is not None

View File

@ -115,7 +115,7 @@ def test_generate_with_built_and_full_path(
result: Result,
mocker: MockerFixture) -> None:
"""
must generate report with built packages
must generate report with built packages and full packages lists
"""
send_mock = mocker.patch("ahriman.core.report.email.Email._send")

View File

@ -64,6 +64,8 @@ def test_process_remove_base(executor: Executor, package_ahriman: Package, mocke
mocker.patch("ahriman.core.repository.executor.Executor.packages", return_value=[package_ahriman])
tree_clear_mock = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_clear")
repo_remove_mock = mocker.patch("ahriman.core.alpm.repo.Repo.remove")
build_queue_mock = mocker.patch("ahriman.core.database.sqlite.SQLite.build_queue_clear")
patches_mock = mocker.patch("ahriman.core.database.sqlite.SQLite.patches_remove")
status_client_mock = mocker.patch("ahriman.core.status.client.Client.remove")
executor.process_remove([package_ahriman.base])
@ -72,6 +74,8 @@ def test_process_remove_base(executor: Executor, package_ahriman: Package, mocke
package_ahriman.base, package_ahriman.packages[package_ahriman.base].filepath)
# must update status and remove package files
tree_clear_mock.assert_called_once_with(package_ahriman.base)
build_queue_mock.assert_called_once_with(package_ahriman.base)
patches_mock.assert_called_once_with(package_ahriman.base)
status_client_mock.assert_called_once_with(package_ahriman.base)

View File

@ -26,7 +26,7 @@ def test_load_full_client(configuration: Configuration) -> None:
def test_load_full_client_from_address(configuration: Configuration) -> None:
"""
must load full client if settings set
must load full client by using address
"""
configuration.set_option("web", "address", "http://localhost:8080")
assert isinstance(Client.load(configuration), WebClient)

View File

@ -23,7 +23,7 @@ def test_ahriman_url(web_client: WebClient) -> None:
def test_status_url(web_client: WebClient) -> None:
"""
must generate service status url correctly
must generate package status url correctly
"""
assert web_client._status_url.startswith(web_client.address)
assert web_client._status_url.endswith("/status-api/v1/status")
@ -67,7 +67,7 @@ def test_login_failed(web_client: WebClient, user: User, mocker: MockerFixture)
def test_login_failed_http_error(web_client: WebClient, user: User, mocker: MockerFixture) -> None:
"""
must suppress any exception happened during login
must suppress HTTP exception happened during login
"""
web_client.user = user
mocker.patch("requests.Session.post", side_effect=requests.exceptions.HTTPError())
@ -112,7 +112,7 @@ def test_add_failed(web_client: WebClient, package_ahriman: Package, mocker: Moc
def test_add_failed_http_error(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
"""
must suppress any exception happened during addition
must suppress HTTP exception happened during addition
"""
mocker.patch("requests.Session.post", side_effect=requests.exceptions.HTTPError())
web_client.add(package_ahriman, BuildStatusEnum.Unknown)
@ -145,7 +145,7 @@ def test_get_failed(web_client: WebClient, mocker: MockerFixture) -> None:
def test_get_failed_http_error(web_client: WebClient, mocker: MockerFixture) -> None:
"""
must suppress any exception happened during status getting
must suppress HTTP exception happened during status getting
"""
mocker.patch("requests.Session.get", side_effect=requests.exceptions.HTTPError())
assert web_client.get(None) == []
@ -193,7 +193,7 @@ def test_get_internal_failed(web_client: WebClient, mocker: MockerFixture) -> No
def test_get_internal_failed_http_error(web_client: WebClient, mocker: MockerFixture) -> None:
"""
must suppress any exception happened during web service status getting
must suppress HTTP exception happened during web service status getting
"""
mocker.patch("requests.Session.get", side_effect=requests.exceptions.HTTPError())
assert web_client.get_internal() == InternalStatus()
@ -224,7 +224,7 @@ def test_get_self_failed(web_client: WebClient, mocker: MockerFixture) -> None:
def test_get_self_failed_http_error(web_client: WebClient, mocker: MockerFixture) -> None:
"""
must suppress any exception happened during service status getting
must suppress HTTP exception happened during service status getting
"""
mocker.patch("requests.Session.get", side_effect=requests.exceptions.HTTPError())
assert web_client.get_self().status == BuildStatusEnum.Unknown
@ -250,7 +250,7 @@ def test_remove_failed(web_client: WebClient, package_ahriman: Package, mocker:
def test_remove_failed_http_error(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
"""
must suppress any exception happened during removal
must suppress HTTP exception happened during removal
"""
mocker.patch("requests.Session.delete", side_effect=requests.exceptions.HTTPError())
web_client.remove(package_ahriman.base)
@ -277,7 +277,7 @@ def test_update_failed(web_client: WebClient, package_ahriman: Package, mocker:
def test_update_failed_http_error(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
"""
must suppress any exception happened during update
must suppress HTTP exception happened during update
"""
mocker.patch("requests.Session.post", side_effect=requests.exceptions.HTTPError())
web_client.update(package_ahriman.base, BuildStatusEnum.Unknown)
@ -304,7 +304,7 @@ def test_update_self_failed(web_client: WebClient, mocker: MockerFixture) -> Non
def test_update_self_failed_http_error(web_client: WebClient, mocker: MockerFixture) -> None:
"""
must suppress any exception happened during service update
must suppress HTTP exception happened during service update
"""
mocker.patch("requests.Session.post", side_effect=requests.exceptions.HTTPError())
web_client.update_self(BuildStatusEnum.Unknown)

View File

@ -231,7 +231,7 @@ def test_gettype_from_section_with_architecture(configuration: Configuration) ->
def test_gettype_from_section_no_section(configuration: Configuration) -> None:
"""
must extract type from section name with architecture
must raise NoSectionError during type extraction from section name with architecture
"""
# technically rsync:x86_64 is valid section
# but in current configuration it must be considered as missing section

View File

@ -19,7 +19,7 @@ def test_build_status_enum_badges_color() -> None:
def test_build_status_enum_bootstrap_color() -> None:
"""
status color must be one of shields.io supported
status color must be one of bootstrap supported
"""
SUPPORTED_COLORS = [
"primary", "secondary", "success", "danger", "warning", "info", "light", "dark"

View File

@ -281,7 +281,7 @@ def test_actual_version_srcinfo_failed(package_tpacpi_bat_git: Package, reposito
def test_actual_version_vcs_failed(package_tpacpi_bat_git: Package, repository_paths: RepositoryPaths,
mocker: MockerFixture) -> None:
"""
must return same version in case if exception occurred
must return same version in case if there are errors during parse
"""
mocker.patch("pathlib.Path.read_text", return_value="")
mocker.patch("ahriman.models.package.parse_srcinfo", return_value=({"packages": {}}, ["an error"]))
@ -292,7 +292,7 @@ def test_actual_version_vcs_failed(package_tpacpi_bat_git: Package, repository_p
def test_full_depends(package_ahriman: Package, package_python_schedule: Package, pyalpm_package_ahriman: MagicMock,
pyalpm_handle: MagicMock, mocker: MockerFixture) -> None:
pyalpm_handle: MagicMock) -> None:
"""
must extract all dependencies from the package
"""