shorten public imports

This commit is contained in:
2022-05-06 04:08:05 +03:00
parent 33e9fea47c
commit 98910240dd
139 changed files with 374 additions and 373 deletions

View File

@ -35,7 +35,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
args = _default_args(args)
args.action = Action.Update
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
application_mock = mocker.patch("ahriman.application.handlers.patch.Patch.patch_set_create")
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_create")
Patch.run(args, "x86_64", configuration, True, False)
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), Path(args.package), args.track)
@ -48,7 +48,7 @@ def test_run_list(args: argparse.Namespace, configuration: Configuration, mocker
args = _default_args(args)
args.action = Action.List
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
application_mock = mocker.patch("ahriman.application.handlers.patch.Patch.patch_set_list")
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_list")
Patch.run(args, "x86_64", configuration, True, False)
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, False)
@ -61,7 +61,7 @@ def test_run_remove(args: argparse.Namespace, configuration: Configuration, mock
args = _default_args(args)
args.action = Action.Remove
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
application_mock = mocker.patch("ahriman.application.handlers.patch.Patch.patch_set_remove")
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_remove")
Patch.run(args, "x86_64", configuration, True, False)
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package)
@ -71,9 +71,9 @@ def test_patch_set_list(application: Application, mocker: MockerFixture) -> None
"""
must list available patches for the command
"""
get_mock = mocker.patch("ahriman.core.database.sqlite.SQLite.patches_list", return_value={"ahriman": "patch"})
print_mock = mocker.patch("ahriman.core.formatters.printer.Printer.print")
check_mock = mocker.patch("ahriman.application.handlers.handler.Handler.check_if_empty")
get_mock = mocker.patch("ahriman.core.database.SQLite.patches_list", return_value={"ahriman": "patch"})
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
Patch.patch_set_list(application, "ahriman", False)
get_mock.assert_called_once_with("ahriman")
@ -85,8 +85,8 @@ def test_patch_set_list_empty_exception(application: Application, mocker: Mocker
"""
must raise ExitCode exception on empty patch list
"""
mocker.patch("ahriman.core.database.sqlite.SQLite.patches_list", return_value={})
check_mock = mocker.patch("ahriman.application.handlers.handler.Handler.check_if_empty")
mocker.patch("ahriman.core.database.SQLite.patches_list", return_value={})
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
Patch.patch_set_list(application, "ahriman", True)
check_mock.assert_called_once_with(True, True)
@ -99,7 +99,7 @@ def test_patch_set_create(application: Application, package_ahriman: Package, mo
mocker.patch("pathlib.Path.mkdir")
mocker.patch("ahriman.models.package.Package.from_build", return_value=package_ahriman)
mocker.patch("ahriman.core.build_tools.sources.Sources.patch_create", return_value="patch")
create_mock = mocker.patch("ahriman.core.database.sqlite.SQLite.patches_insert")
create_mock = mocker.patch("ahriman.core.database.SQLite.patches_insert")
Patch.patch_set_create(application, Path("path"), ["*.patch"])
create_mock.assert_called_once_with(package_ahriman.base, "patch")
@ -109,6 +109,6 @@ def test_patch_set_remove(application: Application, package_ahriman: Package, mo
"""
must remove patch set for the package
"""
remove_mock = mocker.patch("ahriman.core.database.sqlite.SQLite.patches_remove")
remove_mock = mocker.patch("ahriman.core.database.SQLite.patches_remove")
Patch.patch_set_remove(application, package_ahriman.base)
remove_mock.assert_called_once_with(package_ahriman.base)