From d33844e7b26e03699356e1ba8a3e7e68d9fa8d97 Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Sat, 19 Mar 2022 03:08:45 +0300 Subject: [PATCH] ALLOW_AUTO_ARCHITECTURE_RUN flag for unsafe commands --- src/ahriman/application/handlers/unsafe_commands.py | 2 ++ ..._unsafe_commands.py => test_handler_unsafe_commands.py} | 7 +++++++ 2 files changed, 9 insertions(+) rename tests/ahriman/application/handlers/{test_unsafe_commands.py => test_handler_unsafe_commands.py} (87%) diff --git a/src/ahriman/application/handlers/unsafe_commands.py b/src/ahriman/application/handlers/unsafe_commands.py index 8e7b04ba..8be04341 100644 --- a/src/ahriman/application/handlers/unsafe_commands.py +++ b/src/ahriman/application/handlers/unsafe_commands.py @@ -31,6 +31,8 @@ class UnsafeCommands(Handler): unsafe command help parser """ + ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture" + @classmethod def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, no_report: bool, unsafe: bool) -> None: diff --git a/tests/ahriman/application/handlers/test_unsafe_commands.py b/tests/ahriman/application/handlers/test_handler_unsafe_commands.py similarity index 87% rename from tests/ahriman/application/handlers/test_unsafe_commands.py rename to tests/ahriman/application/handlers/test_handler_unsafe_commands.py index 4976953b..80621aac 100644 --- a/tests/ahriman/application/handlers/test_unsafe_commands.py +++ b/tests/ahriman/application/handlers/test_handler_unsafe_commands.py @@ -31,3 +31,10 @@ def test_get_unsafe_commands() -> None: commands = UnsafeCommands.get_unsafe_commands(parser) for command in commands: assert subparser.choices[command].get_default("unsafe") + + +def test_disallow_auto_architecture_run() -> None: + """ + must not allow multi architecture run + """ + assert not UnsafeCommands.ALLOW_AUTO_ARCHITECTURE_RUN