def test_add_package(application: Application, package_ahriman: Package, mocker: MockerFixture) -> None: """ must add package from archive """ mocker.patch("ahriman.application.application.Application._known_packages", return_value=set()) mocker.patch("pathlib.Path.is_file", return_value=True) move_mock = mocker.patch("shutil.move") application.add([package_ahriman.base], False) move_mock.assert_called_once()
def test_add_manual(application: Application, package_ahriman: Package, mocker: MockerFixture) -> None: """ must add package from AUR """ mocker.patch("ahriman.application.application.Application._known_packages", return_value=set()) mocker.patch("ahriman.models.package.Package.load", return_value=package_ahriman) fetch_mock = mocker.patch("ahriman.core.build_tools.task.Task.fetch") application.add([package_ahriman.base], True) fetch_mock.assert_called_once()
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration) -> None: """ callback for command line :param args: command line args :param architecture: repository architecture :param configuration: configuration instance """ application = Application(architecture, configuration) application.add(args.package, args.without_dependencies) if not args.now: return packages = application.get_updates(args.package, True, False, True, application.logger.info) application.update(packages)
def test_add_directory(application: Application, package_ahriman: Package, mocker: MockerFixture) -> None: """ must add packages from directory """ mocker.patch("ahriman.application.application.Application._known_packages", return_value=set()) mocker.patch("pathlib.Path.is_dir", return_value=True) iterdir_mock = mocker.patch( "pathlib.Path.iterdir", return_value=[ package.filepath for package in package_ahriman.packages.values() ]) move_mock = mocker.patch("shutil.move") application.add([package_ahriman.base], False) iterdir_mock.assert_called_once() move_mock.assert_called_once()