add now argument to add command

This commit is contained in:
2021-03-31 02:19:13 +03:00
parent e034327501
commit 2aef906fc8
4 changed files with 26 additions and 2 deletions

View File

@ -8,6 +8,7 @@ from ahriman.core.configuration import Configuration
def _default_args(args: argparse.Namespace) -> argparse.Namespace:
args.package = []
args.now = False
args.without_dependencies = False
return args
@ -22,3 +23,19 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
Add.run(args, "x86_64", configuration)
application_mock.assert_called_once()
def test_run_with_updates(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
"""
must run command with updates after
"""
args = _default_args(args)
args.now = True
mocker.patch("pathlib.Path.mkdir")
mocker.patch("ahriman.application.application.Application.add")
application_mock = mocker.patch("ahriman.application.application.Application.update")
updates_mock = mocker.patch("ahriman.application.application.Application.get_updates")
Add.run(args, "x86_64", configuration)
application_mock.assert_called_once()
updates_mock.assert_called_once()