From b4f955f1245ecdb7d13500bd0bd758918956c362 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sat, 17 Sep 2022 15:16:28 +0200 Subject: Fix handling --no-require-secure-hashes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- gemato/cli.py | 1 + tests/test_openpgp.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gemato/cli.py b/gemato/cli.py index 032bb62..42f4ced 100644 --- a/gemato/cli.py +++ b/gemato/cli.py @@ -309,6 +309,7 @@ class BaseUpdateMixin(BaseManifestLoaderMixin, BaseOpenPGPMixin): help="Require using secure hashes (default if Manifest is signed)") secugroup.add_argument( "--no-require-secure-hashes", action="store_false", + dest="require_secure_hashes", help="Do not require using secure hashes (default if Manifest " "is not signed)") signgroup = update.add_mutually_exclusive_group() diff --git a/tests/test_openpgp.py b/tests/test_openpgp.py index 59deef4..3e30b65 100644 --- a/tests/test_openpgp.py +++ b/tests/test_openpgp.py @@ -1019,13 +1019,13 @@ def test_update_require_secure_cli(base_tree, caplog, hashes_arg, retval = gemato.cli.main(["gemato", "update", "-K", str(base_tree / ".key.bin"), "--hashes", hashes_arg, - str(base_tree)] + - f"{sign} {require_secure}".split()) + str(base_tree)] + + f"{sign} {require_secure}".split()) if str(OpenPGPNoImplementation('install gpg')) in caplog.text: pytest.skip('OpenPGP implementation missing') expected = (1 if insecure is not None and sign != "--no-sign" - and require_secure != "--no-require-secure_hashes" + and require_secure != "--no-require-secure-hashes" else 0) assert retval == expected if expected == 1: -- cgit v1.2.3