From 09a63fcce882fb29a7a75b678c6003d82bbcabeb Mon Sep 17 00:00:00 2001 From: redshiftzero Date: Thu, 17 Jan 2019 18:02:28 -0800 Subject: [PATCH] test: ensure we are using gpg2 binary everywhere in tests 2.1.1 is the default version of gpg2 in xenial 1.4.20 is the default version of gpg in xenial If we do not specify the binary, we can get divergence between test and dev/staging/prod. --- securedrop/tests/conftest.py | 2 +- securedrop/tests/test_integration.py | 2 +- securedrop/tests/utils/env.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/securedrop/tests/conftest.py b/securedrop/tests/conftest.py index 26e739d548..1ed55cbc67 100644 --- a/securedrop/tests/conftest.py +++ b/securedrop/tests/conftest.py @@ -77,7 +77,7 @@ def config(tmpdir): tmp = data.mkdir('tmp') sqlite = data.join('db.sqlite') - gpg = gnupg.GPG(homedir=str(keys)) + gpg = gnupg.GPG('gpg2', homedir=str(keys)) for ext in ['sec', 'pub']: with io.open(path.join(path.dirname(__file__), 'files', diff --git a/securedrop/tests/test_integration.py b/securedrop/tests/test_integration.py index 37cc359dea..b15211a953 100644 --- a/securedrop/tests/test_integration.py +++ b/securedrop/tests/test_integration.py @@ -411,7 +411,7 @@ def _can_decrypt_with_key(journalist_app, msg, key_fpr, passphrase=None): # to use it to test whether a message is decryptable with a specific # key. gpg_tmp_dir = tempfile.mkdtemp() - gpg = gnupg.GPG(homedir=gpg_tmp_dir) + gpg = gnupg.GPG('gpg2', homedir=gpg_tmp_dir) # Export the key of interest from the application's keyring pubkey = journalist_app.crypto_util.gpg.export_keys(key_fpr) diff --git a/securedrop/tests/utils/env.py b/securedrop/tests/utils/env.py index b315c60666..a813b36985 100644 --- a/securedrop/tests/utils/env.py +++ b/securedrop/tests/utils/env.py @@ -37,7 +37,7 @@ def init_gpg(): """Initialize the GPG keyring and import the journalist key for testing. """ - gpg = gnupg.GPG(homedir=config.GPG_KEY_DIR) + gpg = gnupg.GPG('gpg2', homedir=config.GPG_KEY_DIR) # Faster to import a pre-generated key than to gen a new one every time. for keyfile in (join(FILES_DIR, "test_journalist_key.pub"), join(FILES_DIR, "test_journalist_key.sec")):