do not ask confirmation for local sign. Also add argparser test

This commit is contained in:
Evgenii Alekseev 2021-04-10 01:03:15 +03:00
parent fb29c715f0
commit 91793cfbfc
3 changed files with 11 additions and 2 deletions

View File

@ -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]:
"""

View File

@ -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

View File

@ -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))
])