Example #1
0
def test_get_updates_no_manual(application: Application,
                               mocker: MockerFixture) -> None:
    """
    must get updates without manual
    """
    updates_aur_mock = mocker.patch(
        "ahriman.core.repository.update_handler.UpdateHandler.updates_aur")
    updates_manual_mock = mocker.patch(
        "ahriman.core.repository.update_handler.UpdateHandler.updates_manual")

    application.get_updates([],
                            no_aur=False,
                            no_manual=True,
                            no_vcs=False,
                            log_fn=print)
    updates_aur_mock.assert_called_with([], False)
    updates_manual_mock.assert_not_called()
Example #2
0
def test_get_updates_all(application: Application, package_ahriman: Package,
                         mocker: MockerFixture) -> None:
    """
    must get updates for all
    """
    updates_aur_mock = mocker.patch(
        "ahriman.core.repository.update_handler.UpdateHandler.updates_aur",
        return_value=[package_ahriman])
    updates_manual_mock = mocker.patch(
        "ahriman.core.repository.update_handler.UpdateHandler.updates_manual")

    application.get_updates([],
                            no_aur=False,
                            no_manual=False,
                            no_vcs=False,
                            log_fn=print)
    updates_aur_mock.assert_called_with([], False)
    updates_manual_mock.assert_called_once()
Example #3
0
    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)
        packages = application.get_updates(
            args.package, args.no_aur, args.no_manual, args.no_vcs,
            Update.log_fn(application, args.dry_run))
        if args.dry_run:
            return

        application.update(packages)
Example #4
0
    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)