From 91793cfbfc23cf678dffc2635e99d07e407e8b1b Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Sat, 10 Apr 2021 01:03:15 +0300 Subject: [PATCH] do not ask confirmation for local sign. Also add argparser test --- src/ahriman/core/sign/gpg.py | 2 +- tests/ahriman/application/test_ahriman.py | 9 +++++++++ tests/ahriman/core/sign/test_gpg.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ahriman/core/sign/gpg.py b/src/ahriman/core/sign/gpg.py index 5162d8b2..41861800 100644 --- a/src/ahriman/core/sign/gpg.py +++ b/src/ahriman/core/sign/gpg.py @@ -116,7 +116,7 @@ class GPG: """ key_body = self.download_key(server, key) GPG._check_output("gpg", "--import", input_data=key_body, exception=None, logger=self.logger) - GPG._check_output("gpg", "--lsign-key", key, exception=None, logger=self.logger) + GPG._check_output("gpg", "--quick-lsign-key", key, exception=None, logger=self.logger) def process(self, path: Path, key: str) -> List[Path]: """ diff --git a/tests/ahriman/application/test_ahriman.py b/tests/ahriman/application/test_ahriman.py index 65c63d9a..43d0e6c2 100644 --- a/tests/ahriman/application/test_ahriman.py +++ b/tests/ahriman/application/test_ahriman.py @@ -71,6 +71,15 @@ def test_subparsers_config(parser: argparse.ArgumentParser) -> None: assert args.unsafe +def test_subparsers_key_import(parser: argparse.ArgumentParser) -> None: + """ + key-import command must imply lock and no_report + """ + args = parser.parse_args(["-a", "x86_64", "key-import", "key"]) + assert args.lock is None + assert args.no_report + + def test_subparsers_search(parser: argparse.ArgumentParser) -> None: """ search command must imply lock, no_report and unsafe diff --git a/tests/ahriman/core/sign/test_gpg.py b/tests/ahriman/core/sign/test_gpg.py index 35d9299f..a1a18a89 100644 --- a/tests/ahriman/core/sign/test_gpg.py +++ b/tests/ahriman/core/sign/test_gpg.py @@ -92,7 +92,7 @@ def test_import_key(gpg: GPG, mocker: MockerFixture) -> None: gpg.import_key("keys.gnupg.net", "0xE989490C") check_output_mock.assert_has_calls([ mock.call("gpg", "--import", input_data="key", exception=None, logger=pytest.helpers.anyvar(int)), - mock.call("gpg", "--lsign-key", "0xE989490C", exception=None, logger=pytest.helpers.anyvar(int)) + mock.call("gpg", "--quick-lsign-key", "0xE989490C", exception=None, logger=pytest.helpers.anyvar(int)) ])