mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 23:37:18 +00:00
handle None append argument everywhere
This commit is contained in:
parent
812bf07803
commit
b6a9284b92
@ -116,7 +116,7 @@ class Patch(Handler):
|
|||||||
application.database.patches_insert(package_base, patch)
|
application.database.patches_insert(package_base, patch)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def patch_set_list(application: Application, package_base: str | None, variables: list[str],
|
def patch_set_list(application: Application, package_base: str | None, variables: list[str] | None,
|
||||||
exit_code: bool) -> None:
|
exit_code: bool) -> None:
|
||||||
"""
|
"""
|
||||||
list patches available for the package base
|
list patches available for the package base
|
||||||
@ -124,7 +124,7 @@ class Patch(Handler):
|
|||||||
Args:
|
Args:
|
||||||
application(Application): application instance
|
application(Application): application instance
|
||||||
package_base(str | None): package base
|
package_base(str | None): package base
|
||||||
variables(list[str]): extract patches only for specified PKGBUILD variables
|
variables(list[str] | None): extract patches only for specified PKGBUILD variables
|
||||||
exit_code(bool): exit with error on empty search result
|
exit_code(bool): exit with error on empty search result
|
||||||
"""
|
"""
|
||||||
patches = application.database.patches_list(package_base, variables)
|
patches = application.database.patches_list(package_base, variables)
|
||||||
@ -134,13 +134,13 @@ class Patch(Handler):
|
|||||||
PatchPrinter(base, patch).print(verbose=True, separator=" = ")
|
PatchPrinter(base, patch).print(verbose=True, separator=" = ")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def patch_set_remove(application: Application, package_base: str, variables: list[str]) -> None:
|
def patch_set_remove(application: Application, package_base: str, variables: list[str] | None) -> None:
|
||||||
"""
|
"""
|
||||||
remove patch set for the package base
|
remove patch set for the package base
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
application(Application): application instance
|
application(Application): application instance
|
||||||
package_base(str): package base
|
package_base(str): package base
|
||||||
variables(list[str]): remove patches only for specified PKGBUILD variables
|
variables(list[str] | None): remove patches only for specified PKGBUILD variables
|
||||||
"""
|
"""
|
||||||
application.database.patches_remove(package_base, variables)
|
application.database.patches_remove(package_base, variables)
|
||||||
|
@ -48,7 +48,7 @@ class Rebuild(Handler):
|
|||||||
application.on_start()
|
application.on_start()
|
||||||
|
|
||||||
packages = Rebuild.extract_packages(application, args.status, from_database=args.from_database)
|
packages = Rebuild.extract_packages(application, args.status, from_database=args.from_database)
|
||||||
updates = application.repository.packages_depend_on(packages, args.depends_on or None)
|
updates = application.repository.packages_depend_on(packages, args.depends_on)
|
||||||
|
|
||||||
Rebuild.check_if_empty(args.exit_code, not updates)
|
Rebuild.check_if_empty(args.exit_code, not updates)
|
||||||
if args.dry_run:
|
if args.dry_run:
|
||||||
|
@ -117,7 +117,8 @@ class Setup(Handler):
|
|||||||
|
|
||||||
section = Configuration.section_name("sign", repository_id.name, repository_id.architecture)
|
section = Configuration.section_name("sign", repository_id.name, repository_id.architecture)
|
||||||
if args.sign_key is not None:
|
if args.sign_key is not None:
|
||||||
configuration.set_option(section, "target", " ".join([target.name.lower() for target in args.sign_target]))
|
sign_targets = args.sign_target or []
|
||||||
|
configuration.set_option(section, "target", " ".join([target.name.lower() for target in sign_targets]))
|
||||||
configuration.set_option(section, "key", args.sign_key)
|
configuration.set_option(section, "key", args.sign_key)
|
||||||
|
|
||||||
section = Configuration.section_name("web", repository_id.name, repository_id.architecture)
|
section = Configuration.section_name("web", repository_id.name, repository_id.architecture)
|
||||||
|
@ -40,7 +40,7 @@ class PatchOperations(Operations):
|
|||||||
Returns:
|
Returns:
|
||||||
list[PkgbuildPatch]: plain text patch for the package
|
list[PkgbuildPatch]: plain text patch for the package
|
||||||
"""
|
"""
|
||||||
return self.patches_list(package_base, []).get(package_base, [])
|
return self.patches_list(package_base, None).get(package_base, [])
|
||||||
|
|
||||||
def patches_insert(self, package_base: str, patch: PkgbuildPatch) -> None:
|
def patches_insert(self, package_base: str, patch: PkgbuildPatch) -> None:
|
||||||
"""
|
"""
|
||||||
@ -64,13 +64,13 @@ class PatchOperations(Operations):
|
|||||||
|
|
||||||
return self.with_connection(run, commit=True)
|
return self.with_connection(run, commit=True)
|
||||||
|
|
||||||
def patches_list(self, package_base: str | None, variables: list[str]) -> dict[str, list[PkgbuildPatch]]:
|
def patches_list(self, package_base: str | None, variables: list[str] | None) -> dict[str, list[PkgbuildPatch]]:
|
||||||
"""
|
"""
|
||||||
extract all patches
|
extract all patches
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
package_base(str | None): optional filter by package base
|
package_base(str | None): optional filter by package base
|
||||||
variables(list[str]): extract patches only for specified PKGBUILD variables
|
variables(list[str] | None): extract patches only for specified PKGBUILD variables
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
dict[str, list[PkgbuildPatch]]: map of package base to patch content
|
dict[str, list[PkgbuildPatch]]: map of package base to patch content
|
||||||
@ -86,29 +86,30 @@ class PatchOperations(Operations):
|
|||||||
# we could use itertools & operator but why?
|
# we could use itertools & operator but why?
|
||||||
patches: dict[str, list[PkgbuildPatch]] = defaultdict(list)
|
patches: dict[str, list[PkgbuildPatch]] = defaultdict(list)
|
||||||
for package, patch in self.with_connection(run):
|
for package, patch in self.with_connection(run):
|
||||||
if variables and patch.key not in variables:
|
if variables is not None and patch.key not in variables:
|
||||||
continue
|
continue
|
||||||
patches[package].append(patch)
|
patches[package].append(patch)
|
||||||
return dict(patches)
|
return dict(patches)
|
||||||
|
|
||||||
def patches_remove(self, package_base: str, variables: list[str]) -> None:
|
def patches_remove(self, package_base: str, variables: list[str] | None) -> None:
|
||||||
"""
|
"""
|
||||||
remove patch set
|
remove patch set
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
package_base(str): package base to clear patches
|
package_base(str): package base to clear patches
|
||||||
variables(list[str]): remove patches only for specified PKGBUILD variables
|
variables(list[str] | None): remove patches only for specified PKGBUILD variables
|
||||||
"""
|
"""
|
||||||
def run_many(connection: Connection) -> None:
|
def run_many(connection: Connection) -> None:
|
||||||
|
patches = variables or [] # suppress mypy warning
|
||||||
connection.executemany(
|
connection.executemany(
|
||||||
"""delete from patches where package_base = :package_base and variable = :variable""",
|
"""delete from patches where package_base = :package_base and variable = :variable""",
|
||||||
[{"package_base": package_base, "variable": variable} for variable in variables])
|
[{"package_base": package_base, "variable": variable} for variable in patches])
|
||||||
|
|
||||||
def run(connection: Connection) -> None:
|
def run(connection: Connection) -> None:
|
||||||
connection.execute(
|
connection.execute(
|
||||||
"""delete from patches where package_base = :package_base""",
|
"""delete from patches where package_base = :package_base""",
|
||||||
{"package_base": package_base})
|
{"package_base": package_base})
|
||||||
|
|
||||||
if variables:
|
if variables is not None:
|
||||||
return self.with_connection(run_many, commit=True)
|
return self.with_connection(run_many, commit=True)
|
||||||
return self.with_connection(run, commit=True)
|
return self.with_connection(run, commit=True)
|
||||||
|
@ -23,7 +23,7 @@ def _default_args(args: argparse.Namespace) -> argparse.Namespace:
|
|||||||
Returns:
|
Returns:
|
||||||
argparse.Namespace: generated arguments for these test cases
|
argparse.Namespace: generated arguments for these test cases
|
||||||
"""
|
"""
|
||||||
args.depends_on = []
|
args.depends_on = None
|
||||||
args.dry_run = False
|
args.dry_run = False
|
||||||
args.from_database = False
|
args.from_database = False
|
||||||
args.exit_code = False
|
args.exit_code = False
|
||||||
|
@ -59,7 +59,15 @@ def test_parser_option_wait_timeout(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert isinstance(args.wait_timeout, int)
|
assert isinstance(args.wait_timeout, int)
|
||||||
|
|
||||||
|
|
||||||
def test_multiple_architectures(parser: argparse.ArgumentParser) -> None:
|
def test_parser_option_architecture_empty(parser: argparse.ArgumentParser) -> None:
|
||||||
|
"""
|
||||||
|
must parse empty architecture list as None
|
||||||
|
"""
|
||||||
|
args = parser.parse_args(["service-config"])
|
||||||
|
assert args.architecture is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_parser_option_architecture_multiple(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
must accept multiple architectures
|
must accept multiple architectures
|
||||||
"""
|
"""
|
||||||
@ -67,7 +75,15 @@ def test_multiple_architectures(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.architecture == ["x86_64", "i686"]
|
assert args.architecture == ["x86_64", "i686"]
|
||||||
|
|
||||||
|
|
||||||
def test_multiple_repositories(parser: argparse.ArgumentParser) -> None:
|
def test_parser_option_repository_empty(parser: argparse.ArgumentParser) -> None:
|
||||||
|
"""
|
||||||
|
must parse empty repository list as None
|
||||||
|
"""
|
||||||
|
args = parser.parse_args(["service-config"])
|
||||||
|
assert args.repository is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_parser_option_repository_multiple(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
must accept multiple architectures
|
must accept multiple architectures
|
||||||
"""
|
"""
|
||||||
@ -87,7 +103,7 @@ def test_subparsers_aur_search(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_aur_search_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_aur_search_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
aur-search command must correctly parse architecture list
|
aur-search command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -108,7 +124,7 @@ def test_subparsers_help(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.parser is not None and args.parser()
|
assert args.parser is not None and args.parser()
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_help_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_help_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
help command must correctly parse architecture list
|
help command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -129,7 +145,7 @@ def test_subparsers_help_commands_unsafe(parser: argparse.ArgumentParser) -> Non
|
|||||||
assert args.parser is not None and args.parser()
|
assert args.parser is not None and args.parser()
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_help_commands_unsafe_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_help_commands_unsafe_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
help-commands-unsafe command must correctly parse architecture list
|
help-commands-unsafe command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -149,7 +165,7 @@ def test_subparsers_help_updates(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_help_updates_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_help_updates_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
help-updates command must correctly parse architecture list
|
help-updates command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -169,7 +185,7 @@ def test_subparsers_help_version(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_help_version_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_help_version_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
help-version command must correctly parse architecture list
|
help-version command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -177,7 +193,7 @@ def test_subparsers_help_version_architecture(parser: argparse.ArgumentParser) -
|
|||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_package_add_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_package_add_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
package-add command must correctly parse architecture list
|
package-add command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -199,7 +215,7 @@ def test_subparsers_package_add_option_refresh(parser: argparse.ArgumentParser)
|
|||||||
assert args.refresh == 2
|
assert args.refresh == 2
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_package_remove_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_package_remove_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
package-remove command must correctly parse architecture list
|
package-remove command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -268,7 +284,7 @@ def test_subparsers_patch_add(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert not args.report
|
assert not args.report
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_patch_add_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_add_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
patch-add command must correctly parse architecture list
|
patch-add command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -288,7 +304,7 @@ def test_subparsers_patch_list(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_patch_list_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_list_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
patch-list command must correctly parse architecture list
|
patch-list command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -296,6 +312,22 @@ def test_subparsers_patch_list_architecture(parser: argparse.ArgumentParser) ->
|
|||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
|
|
||||||
|
|
||||||
|
def test_subparsers_patch_list_option_variable_empty(parser: argparse.ArgumentParser) -> None:
|
||||||
|
"""
|
||||||
|
patch-list command must accept empty variable list as None
|
||||||
|
"""
|
||||||
|
args = parser.parse_args(["patch-list", "ahriman"])
|
||||||
|
assert args.variable is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_subparsers_patch_list_option_variable_multiple(parser: argparse.ArgumentParser) -> None:
|
||||||
|
"""
|
||||||
|
patch-list command must accept multiple variables
|
||||||
|
"""
|
||||||
|
args = parser.parse_args(["patch-list", "-v", "var1", "-v", "var2", "ahriman"])
|
||||||
|
assert args.variable == ["var1", "var2"]
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_patch_remove(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_remove(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
patch-remove command must imply action, architecture list, lock and report
|
patch-remove command must imply action, architecture list, lock and report
|
||||||
@ -307,7 +339,7 @@ def test_subparsers_patch_remove(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert not args.report
|
assert not args.report
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_patch_remove_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_remove_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
patch-remove command must correctly parse architecture list
|
patch-remove command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -315,6 +347,22 @@ def test_subparsers_patch_remove_architecture(parser: argparse.ArgumentParser) -
|
|||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
|
|
||||||
|
|
||||||
|
def test_subparsers_patch_remove_option_variable_empty(parser: argparse.ArgumentParser) -> None:
|
||||||
|
"""
|
||||||
|
patch-remove command must accept empty variable list as None
|
||||||
|
"""
|
||||||
|
args = parser.parse_args(["patch-remove", "ahriman"])
|
||||||
|
assert args.variable is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_subparsers_patch_remove_option_variable_multiple(parser: argparse.ArgumentParser) -> None:
|
||||||
|
"""
|
||||||
|
patch-remove command must accept multiple variables
|
||||||
|
"""
|
||||||
|
args = parser.parse_args(["patch-remove", "-v", "var1", "-v", "var2", "ahriman"])
|
||||||
|
assert args.variable == ["var1", "var2"]
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_patch_set_add(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_set_add(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
patch-set-add command must imply action, architecture list, lock, report and variable
|
patch-set-add command must imply action, architecture list, lock, report and variable
|
||||||
@ -327,7 +375,7 @@ def test_subparsers_patch_set_add(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.variable is None
|
assert args.variable is None
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_patch_set_add_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_set_add_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
patch-set-add command must correctly parse architecture list
|
patch-set-add command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -362,7 +410,7 @@ def test_subparsers_repo_backup(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_backup_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_backup_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-backup command must correctly parse architecture list
|
repo-backup command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -382,7 +430,7 @@ def test_subparsers_repo_check(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.username is None
|
assert args.username is None
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_check_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_check_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-check command must correctly parse architecture list
|
repo-check command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -412,7 +460,7 @@ def test_subparsers_repo_create_keyring(parser: argparse.ArgumentParser) -> None
|
|||||||
assert args.trigger == ["ahriman.core.support.KeyringTrigger"]
|
assert args.trigger == ["ahriman.core.support.KeyringTrigger"]
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_create_keyring_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_create_keyring_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-create-keyring command must correctly parse architecture list
|
repo-create-keyring command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -430,7 +478,7 @@ def test_subparsers_repo_create_mirrorlist(parser: argparse.ArgumentParser) -> N
|
|||||||
assert args.trigger == ["ahriman.core.support.MirrorlistTrigger"]
|
assert args.trigger == ["ahriman.core.support.MirrorlistTrigger"]
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_create_mirrorlist_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_create_mirrorlist_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-create-mirrorlist command must correctly parse architecture list
|
repo-create-mirrorlist command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -472,7 +520,7 @@ def test_subparsers_repo_daemon_option_interval(parser: argparse.ArgumentParser)
|
|||||||
assert isinstance(args.interval, int)
|
assert isinstance(args.interval, int)
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_rebuild_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_rebuild_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-rebuild command must correctly parse architecture list
|
repo-rebuild command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -482,6 +530,22 @@ def test_subparsers_repo_rebuild_architecture(parser: argparse.ArgumentParser) -
|
|||||||
assert args.architecture == ["x86_64"]
|
assert args.architecture == ["x86_64"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_subparsers_repo_rebuild_option_depends_on_empty(parser: argparse.ArgumentParser) -> None:
|
||||||
|
"""
|
||||||
|
repo-rebuild command must accept empty depends-on list as None
|
||||||
|
"""
|
||||||
|
args = parser.parse_args(["repo-rebuild"])
|
||||||
|
assert args.depends_on is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_subparsers_repo_rebuild_option_depends_on_multiple(parser: argparse.ArgumentParser) -> None:
|
||||||
|
"""
|
||||||
|
repo-rebuild command must accept multiple depends-on
|
||||||
|
"""
|
||||||
|
args = parser.parse_args(["repo-rebuild", "--depends-on", "package1", "--depends-on", "package2"])
|
||||||
|
assert args.depends_on == ["package1", "package2"]
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_rebuild_option_status(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_rebuild_option_status(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-rebuild command must convert status option to BuildStatusEnum instance
|
repo-rebuild command must convert status option to BuildStatusEnum instance
|
||||||
@ -490,7 +554,7 @@ def test_subparsers_repo_rebuild_option_status(parser: argparse.ArgumentParser)
|
|||||||
assert isinstance(args.status, BuildStatusEnum)
|
assert isinstance(args.status, BuildStatusEnum)
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_remove_unknown_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_remove_unknown_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-remove-unknown command must correctly parse architecture list
|
repo-remove-unknown command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -508,7 +572,7 @@ def test_subparsers_repo_report(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.trigger == ["ahriman.core.report.ReportTrigger"]
|
assert args.trigger == ["ahriman.core.report.ReportTrigger"]
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_report_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_report_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-report command must correctly parse architecture list
|
repo-report command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -529,7 +593,7 @@ def test_subparsers_repo_restore(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_restore_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_restore_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-restore command must correctly parse architecture list
|
repo-restore command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -537,7 +601,7 @@ def test_subparsers_repo_restore_architecture(parser: argparse.ArgumentParser) -
|
|||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_sign_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_sign_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-sign command must correctly parse architecture list
|
repo-sign command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -579,7 +643,7 @@ def test_subparsers_repo_sync(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.trigger == ["ahriman.core.upload.UploadTrigger"]
|
assert args.trigger == ["ahriman.core.upload.UploadTrigger"]
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_sync_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_sync_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-sync command must correctly parse architecture list
|
repo-sync command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -600,7 +664,7 @@ def test_subparsers_repo_tree(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_tree_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_tree_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-tree command must correctly parse architecture list
|
repo-tree command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -620,7 +684,7 @@ def test_subparsers_repo_tree_option_partitions(parser: argparse.ArgumentParser)
|
|||||||
assert isinstance(args.partitions, int)
|
assert isinstance(args.partitions, int)
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_triggers_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_triggers_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-triggers command must correctly parse architecture list
|
repo-triggers command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -630,7 +694,7 @@ def test_subparsers_repo_triggers_architecture(parser: argparse.ArgumentParser)
|
|||||||
assert args.architecture == ["x86_64"]
|
assert args.architecture == ["x86_64"]
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_update_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_update_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-update command must correctly parse architecture list
|
repo-update command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -661,7 +725,7 @@ def test_subparsers_service_clean(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_service_clean_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_service_clean_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
service-clean command must correctly parse architecture list
|
service-clean command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -705,7 +769,7 @@ def test_subparsers_service_key_import(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert not args.report
|
assert not args.report
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_service_key_import_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_service_key_import_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
service-key-import command must correctly parse architecture list
|
service-key-import command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -746,6 +810,23 @@ def test_subparsers_service_setup_option_sign_target(parser: argparse.ArgumentPa
|
|||||||
assert all(isinstance(target, SignSettings) for target in args.sign_target)
|
assert all(isinstance(target, SignSettings) for target in args.sign_target)
|
||||||
|
|
||||||
|
|
||||||
|
def test_subparsers_service_setup_option_sign_target_empty(parser: argparse.ArgumentParser) -> None:
|
||||||
|
"""
|
||||||
|
service-setup command must accept empty sign-target list as None
|
||||||
|
"""
|
||||||
|
args = parser.parse_args(["-a", "x86_64", "service-setup", "--packager", "John Doe <john@doe.com>"])
|
||||||
|
assert args.sign_target is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_subparsers_service_setup_option_sign_target_multiple(parser: argparse.ArgumentParser) -> None:
|
||||||
|
"""
|
||||||
|
service-setup command must accept multiple sign-target
|
||||||
|
"""
|
||||||
|
args = parser.parse_args(["-a", "x86_64", "service-setup", "--packager", "John Doe <john@doe.com>",
|
||||||
|
"--sign-target", "packages", "--sign-target", "repository"])
|
||||||
|
assert args.sign_target == [SignSettings.Packages, SignSettings.Repository]
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_service_shell(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_service_shell(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
service-shell command must imply lock and report
|
service-shell command must imply lock and report
|
||||||
@ -767,7 +848,7 @@ def test_subparsers_user_add(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.quiet
|
assert args.quiet
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_user_add_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_user_add_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
user-add command must correctly parse architecture list
|
user-add command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -798,7 +879,7 @@ def test_subparsers_user_list(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_user_list_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_user_list_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
user-list command must correctly parse architecture list
|
user-list command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
@ -826,7 +907,7 @@ def test_subparsers_user_remove(parser: argparse.ArgumentParser) -> None:
|
|||||||
assert args.quiet
|
assert args.quiet
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_user_remove_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_user_remove_option_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
user-remove command must correctly parse architecture list
|
user-remove command must correctly parse architecture list
|
||||||
"""
|
"""
|
||||||
|
@ -22,7 +22,7 @@ def test_patches_list(database: SQLite, package_ahriman: Package, package_python
|
|||||||
database.patches_insert(package_ahriman.base, PkgbuildPatch(None, "patch1"))
|
database.patches_insert(package_ahriman.base, PkgbuildPatch(None, "patch1"))
|
||||||
database.patches_insert(package_ahriman.base, PkgbuildPatch("key", "patch3"))
|
database.patches_insert(package_ahriman.base, PkgbuildPatch("key", "patch3"))
|
||||||
database.patches_insert(package_python_schedule.base, PkgbuildPatch(None, "patch2"))
|
database.patches_insert(package_python_schedule.base, PkgbuildPatch(None, "patch2"))
|
||||||
assert database.patches_list(None, []) == {
|
assert database.patches_list(None, None) == {
|
||||||
package_ahriman.base: [PkgbuildPatch(None, "patch1"), PkgbuildPatch("key", "patch3")],
|
package_ahriman.base: [PkgbuildPatch(None, "patch1"), PkgbuildPatch("key", "patch3")],
|
||||||
package_python_schedule.base: [PkgbuildPatch(None, "patch2")],
|
package_python_schedule.base: [PkgbuildPatch(None, "patch2")],
|
||||||
}
|
}
|
||||||
@ -35,8 +35,8 @@ def test_patches_list_filter(database: SQLite, package_ahriman: Package, package
|
|||||||
database.patches_insert(package_ahriman.base, PkgbuildPatch(None, "patch1"))
|
database.patches_insert(package_ahriman.base, PkgbuildPatch(None, "patch1"))
|
||||||
database.patches_insert(package_python_schedule.base, PkgbuildPatch(None, "patch2"))
|
database.patches_insert(package_python_schedule.base, PkgbuildPatch(None, "patch2"))
|
||||||
|
|
||||||
assert database.patches_list(package_ahriman.base, []) == {package_ahriman.base: [PkgbuildPatch(None, "patch1")]}
|
assert database.patches_list(package_ahriman.base, None) == {package_ahriman.base: [PkgbuildPatch(None, "patch1")]}
|
||||||
assert database.patches_list(package_python_schedule.base, []) == {
|
assert database.patches_list(package_python_schedule.base, None) == {
|
||||||
package_python_schedule.base: [PkgbuildPatch(None, "patch2")],
|
package_python_schedule.base: [PkgbuildPatch(None, "patch2")],
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ def test_patches_list_filter_by_variable(database: SQLite, package_ahriman: Pack
|
|||||||
database.patches_insert(package_ahriman.base, PkgbuildPatch("key", "patch2"))
|
database.patches_insert(package_ahriman.base, PkgbuildPatch("key", "patch2"))
|
||||||
database.patches_insert(package_python_schedule.base, PkgbuildPatch(None, "patch3"))
|
database.patches_insert(package_python_schedule.base, PkgbuildPatch(None, "patch3"))
|
||||||
|
|
||||||
assert database.patches_list(None, []) == {
|
assert database.patches_list(None, None) == {
|
||||||
package_ahriman.base: [PkgbuildPatch(None, "patch1"), PkgbuildPatch("key", "patch2")],
|
package_ahriman.base: [PkgbuildPatch(None, "patch1"), PkgbuildPatch("key", "patch2")],
|
||||||
package_python_schedule.base: [PkgbuildPatch(None, "patch3")],
|
package_python_schedule.base: [PkgbuildPatch(None, "patch3")],
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ def test_patches_insert_remove(database: SQLite, package_ahriman: Package, packa
|
|||||||
"""
|
"""
|
||||||
database.patches_insert(package_ahriman.base, PkgbuildPatch(None, "patch1"))
|
database.patches_insert(package_ahriman.base, PkgbuildPatch(None, "patch1"))
|
||||||
database.patches_insert(package_python_schedule.base, PkgbuildPatch(None, "patch2"))
|
database.patches_insert(package_python_schedule.base, PkgbuildPatch(None, "patch2"))
|
||||||
database.patches_remove(package_ahriman.base, [])
|
database.patches_remove(package_ahriman.base, None)
|
||||||
|
|
||||||
assert database.patches_get(package_ahriman.base) == []
|
assert database.patches_get(package_ahriman.base) == []
|
||||||
assert database.patches_get(package_python_schedule.base) == [PkgbuildPatch(None, "patch2")]
|
assert database.patches_get(package_python_schedule.base) == [PkgbuildPatch(None, "patch2")]
|
||||||
|
Loading…
Reference in New Issue
Block a user