add init subcommand

This commit is contained in:
2021-05-20 00:52:10 +03:00
parent 783b7d043d
commit 10806e78ae
6 changed files with 82 additions and 1 deletions

View File

@ -0,0 +1,16 @@
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
"""
create_tree_mock = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.create_tree")
Init.run(args, "x86_64", configuration)
create_tree_mock.assert_called_once()

View File

@ -73,6 +73,14 @@ def test_subparsers_config(parser: argparse.ArgumentParser) -> None:
assert args.unsafe
def test_subparsers_init(parser: argparse.ArgumentParser) -> None:
"""
init command must imply no_report
"""
args = parser.parse_args(["-a", "x86_64", "init"])
assert args.no_report
def test_subparsers_key_import(parser: argparse.ArgumentParser) -> None:
"""
key-import command must imply lock and no_report

View File

@ -8,7 +8,7 @@ from ahriman.models.package import Package
async def test_get(client: TestClient, package_ahriman: Package) -> None:
"""
must generate web service status correctly)
must generate web service status correctly
"""
await client.post(f"/api/v1/packages/{package_ahriman.base}",
json={"status": BuildStatusEnum.Success.value, "package": package_ahriman.view()})