mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 15:27:17 +00:00
add repo-status-update subcommand
This commit is contained in:
parent
56b77a84a6
commit
22d92e3b4e
@ -85,6 +85,7 @@ def _parser() -> argparse.ArgumentParser:
|
||||
_set_repo_report_parser(subparsers)
|
||||
_set_repo_setup_parser(subparsers)
|
||||
_set_repo_sign_parser(subparsers)
|
||||
_set_repo_status_update_parser(subparsers)
|
||||
_set_repo_sync_parser(subparsers)
|
||||
_set_repo_update_parser(subparsers)
|
||||
_set_user_add_parser(subparsers)
|
||||
@ -408,6 +409,21 @@ def _set_repo_sign_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
return parser
|
||||
|
||||
|
||||
def _set_repo_status_update_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
add parser for repository status update subcommand
|
||||
:param root: subparsers for the commands
|
||||
:return: created argument parser
|
||||
"""
|
||||
parser = root.add_parser("repo-status-update", help="update repository status",
|
||||
description="update repository status on the status page", formatter_class=_formatter)
|
||||
parser.add_argument("-s", "--status", help="new status",
|
||||
type=BuildStatusEnum, choices=BuildStatusEnum, default=BuildStatusEnum.Success)
|
||||
parser.set_defaults(handler=handlers.StatusUpdate, action=Action.Update, lock=None, no_report=True, package=[],
|
||||
quiet=True, unsafe=True)
|
||||
return parser
|
||||
|
||||
|
||||
def _set_repo_sync_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
||||
"""
|
||||
add parser for repository sync subcommand
|
||||
|
@ -351,6 +351,30 @@ def test_subparsers_repo_sign_architecture(parser: argparse.ArgumentParser) -> N
|
||||
assert args.architecture == ["x86_64"]
|
||||
|
||||
|
||||
def test_subparsers_repo_status_update(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
re[p-status-update command must imply action, lock, no-report, package, quiet and unsafe
|
||||
"""
|
||||
args = parser.parse_args(["-a", "x86_64", "package-status-update"])
|
||||
assert args.architecture == ["x86_64"]
|
||||
assert args.action == Action.Update
|
||||
assert args.lock is None
|
||||
assert args.no_report
|
||||
assert not args.package
|
||||
assert args.quiet
|
||||
assert args.unsafe
|
||||
|
||||
|
||||
def test_subparsers_repo_status_update_option_status(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
repo-status-update command must convert status option to buildstatusenum instance
|
||||
"""
|
||||
args = parser.parse_args(["-a", "x86_64", "repo-status-update"])
|
||||
assert isinstance(args.status, BuildStatusEnum)
|
||||
args = parser.parse_args(["-a", "x86_64", "repo-status-update", "--status", "failed"])
|
||||
assert isinstance(args.status, BuildStatusEnum)
|
||||
|
||||
|
||||
def test_subparsers_repo_sync_architecture(parser: argparse.ArgumentParser) -> None:
|
||||
"""
|
||||
repo-sync command must correctly parse architecture list
|
||||
|
Loading…
Reference in New Issue
Block a user