diff options
author | Michał Górny <mgorny@gentoo.org> | 2020-05-16 17:09:46 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2020-05-16 17:10:14 +0200 |
commit | 73f9a2f9fb0990b964dc8fadf32ee2b76c30419c (patch) | |
tree | 452b10773903c8dd3bcd55182400e99648e03d19 /tests/testutil.py | |
parent | f3d79b33a21c4683c39600b63b958c3b0e2c4e2d (diff) | |
download | gemato-73f9a2f9fb0990b964dc8fadf32ee2b76c30419c.tar.gz |
openpgp: Pass 'gpg --batch' to _spawn_gpg() explicitly
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'tests/testutil.py')
-rw-r--r-- | tests/testutil.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/testutil.py b/tests/testutil.py index ad9525d..572dad6 100644 --- a/tests/testutil.py +++ b/tests/testutil.py @@ -1,6 +1,6 @@ # gemato: Test utility functions # vim:fileencoding=utf-8 -# (c) 2017-2018 Michał Górny +# (c) 2017-2020 Michał Górny # Licensed under the terms of 2-clause BSD license import errno @@ -141,16 +141,19 @@ class MockedWKDOpenPGPEnvironment(gemato.openpgp.OpenPGPEnvironment): def clone(self): return MockedWKDOpenPGPEnvironment(self.keys) - def _spawn_gpg(self, args, stdin): - if '--locate-keys' in args: - args.remove('--locate-keys') - assert len(args) == 1 - if args[0] in self.keys: + def _spawn_gpg(self, argv, stdin): + if '--locate-keys' in argv: + argv.remove('--locate-keys') + assert len(argv) == 3 + assert argv[:2] == ['gpg', '--batch'] + if argv[2] in self.keys: ret, sout, serr = super(MockedWKDOpenPGPEnvironment, - self)._spawn_gpg(['--import'], self.keys[args[0]]) + self)._spawn_gpg( + ['gpg', '--batch', '--import'], + self.keys[argv[2]]) else: ret = 2 return (ret, b'', b'') return super(MockedWKDOpenPGPEnvironment, self)._spawn_gpg( - args, stdin) + argv, stdin) |