mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-24 03:09:56 +00:00
deprecate init/repo-init command
In current workflow you need to run setup to run init (because of repository name), but you need to run init before setup (because of repository tree rights). New solution just add `Repo.init()` method call to setup subcommand after config reload to make sure that repository name has been applied. In addition chown method as well as setuid method for check_output have been added.
This commit is contained in:
@ -6,7 +6,7 @@ from pytest_mock import MockerFixture
|
||||
|
||||
from ahriman.application.handlers import Handler
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.core.exceptions import MissingArchitecture, MultipleArchitecture
|
||||
from ahriman.core.exceptions import MissingArchitecture, MultipleArchitectures
|
||||
|
||||
|
||||
def test_architectures_extract(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||
@ -94,7 +94,7 @@ def test_execute_multiple_not_supported(args: argparse.Namespace, mocker: Mocker
|
||||
args.command = "web"
|
||||
mocker.patch.object(Handler, "ALLOW_MULTI_ARCHITECTURE_RUN", False)
|
||||
|
||||
with pytest.raises(MultipleArchitecture):
|
||||
with pytest.raises(MultipleArchitectures):
|
||||
Handler.execute(args)
|
||||
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
import argparse
|
||||
|
||||
from pytest_mock import MockerFixture
|
||||
|
||||
from ahriman.application.handlers import Init
|
||||
from ahriman.core.configuration import Configuration
|
||||
|
||||
|
||||
def test_run(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must run command
|
||||
"""
|
||||
mocker.patch("ahriman.core.repository.properties.check_user")
|
||||
tree_create_mock = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||
init_mock = mocker.patch("ahriman.core.alpm.repo.Repo.init")
|
||||
|
||||
Init.run(args, "x86_64", configuration, True, False)
|
||||
tree_create_mock.assert_called_once_with()
|
||||
init_mock.assert_called_once_with()
|
||||
|
||||
|
||||
def test_disallow_auto_architecture_run() -> None:
|
||||
"""
|
||||
must not allow multi architecture run
|
||||
"""
|
||||
assert not Init.ALLOW_AUTO_ARCHITECTURE_RUN
|
@ -40,6 +40,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
||||
makepkg_configuration_mock = mocker.patch("ahriman.application.handlers.setup.Setup.configuration_create_makepkg")
|
||||
sudo_configuration_mock = mocker.patch("ahriman.application.handlers.setup.Setup.configuration_create_sudo")
|
||||
executable_mock = mocker.patch("ahriman.application.handlers.setup.Setup.executable_create")
|
||||
init_mock = mocker.patch("ahriman.core.alpm.repo.Repo.init")
|
||||
paths = RepositoryPaths(configuration.getpath("repository", "root"), "x86_64")
|
||||
|
||||
Setup.run(args, "x86_64", configuration, True, False)
|
||||
@ -49,6 +50,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
||||
makepkg_configuration_mock.assert_called_once_with(args.packager, paths)
|
||||
sudo_configuration_mock.assert_called_once_with(args.build_command, "x86_64")
|
||||
executable_mock.assert_called_once_with(args.build_command, "x86_64")
|
||||
init_mock.assert_called_once()
|
||||
|
||||
|
||||
def test_build_command(args: argparse.Namespace) -> None:
|
||||
|
Reference in New Issue
Block a user