From 0d5a878986db4466ac28633b6511c934a34e6cc9 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 16 Mar 2017 11:50:45 -0700 Subject: [PATCH] In the tests, always initialize GnuPG object in debug mode --- test/gnupg_test.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/gnupg_test.py b/test/gnupg_test.py index e9490d8..cbd1171 100644 --- a/test/gnupg_test.py +++ b/test/gnupg_test.py @@ -8,48 +8,48 @@ from .test_helpers import * def test_gpg_is_available(): - gpg = GnuPG() + gpg = GnuPG(debug=True) assert gpg.is_gpg_available() -def test_gpg_recv_key(): +def test_gpg_recv_key(debug=True): gpg = GnuPG() gpg.recv_key(b'hkp://keys.gnupg.net', test_key_fp, False, None, None) assert gpg.get_uid(test_key_fp) == 'GPG Sync Unit Test Key (not secure in any way)' @raises(InvalidKeyserver) def test_gpg_recv_key_invalid_keyserver(): - gpg = GnuPG() + gpg = GnuPG(debug=True) gpg.recv_key(b'hkp://fakekeyserver', test_key_fp, False, None, None) @raises(NotFoundOnKeyserver) def test_gpg_recv_key_not_found_on_keyserver(): - gpg = GnuPG() + gpg = GnuPG(debug=True) gpg.recv_key(b'hkp://keys.gnupg.net', b'0000000000000000000000000000000000000000', False, None, None) @raises(InvalidFingerprint) def test_gpg_test_key_invalid_fingerprint(): - gpg = GnuPG() + gpg = GnuPG(debug=True) gpg.test_key(b'deadbeef') @raises(NotFoundInKeyring) def test_gpg_test_key_not_found_in_keyring(): - gpg = GnuPG() + gpg = GnuPG(debug=True) gpg.test_key(b'0000000000000000000000000000000000000000') @raises(RevokedKey) def test_gpg_test_key_revoked(): - gpg = GnuPG() + gpg = GnuPG(debug=True) import_key('revoked_pubkey.asc', gpg.homedir) gpg.test_key(b'79358BDE97F831D6027B8FFBDB2F866200EBDDE9') @raises(ExpiredKey) def test_gpg_test_key_expired(): - gpg = GnuPG() + gpg = GnuPG(debug=True) import_key('expired_pubkey.asc', gpg.homedir) gpg.test_key(b'30996DFF545AD6A02462639624C6564F385E35F8') def test_gpg_get_uid(): - gpg = GnuPG() + gpg = GnuPG(debug=True) import_key('pgpsync_multiple_uids.asc', gpg.homedir) import_key('gpgsync_test_pubkey.asc', gpg.homedir) @@ -59,7 +59,7 @@ def test_gpg_get_uid(): def test_gpg_verify(): # test a message that works to verify - gpg = GnuPG() + gpg = GnuPG(debug=True) import_key('gpgsync_test_pubkey.asc', gpg.homedir) msg = open(get_gpg_file('signed_message-valid.txt'), 'rb').read() msg_sig = open(get_gpg_file('signed_message-valid.txt.sig'), 'rb').read() @@ -68,7 +68,7 @@ def test_gpg_verify(): @raises(BadSignature) def test_gpg_verify_invalid_sig(): # test a message with an invalid sig - gpg = GnuPG() + gpg = GnuPG(debug=True) import_key('gpgsync_test_pubkey.asc', gpg.homedir) msg = open(get_gpg_file('signed_message-invalid.txt'), 'rb').read() msg_sig = open(get_gpg_file('signed_message-invalid.txt.sig'), 'rb').read() @@ -76,7 +76,7 @@ def test_gpg_verify_invalid_sig(): @raises(RevokedKey) def test_gpg_verify_revoked(): - gpg = GnuPG() + gpg = GnuPG(debug=True) import_key('revoked_pubkey.asc', gpg.homedir) msg = open(get_gpg_file('signed_message-revoked.txt'), 'rb').read() msg_sig = open(get_gpg_file('signed_message-revoked.txt.sig'), 'rb').read() @@ -84,7 +84,7 @@ def test_gpg_verify_revoked(): @raises(ExpiredKey) def test_gpg_verify_expired(): - gpg = GnuPG() + gpg = GnuPG(debug=True) import_key('expired_pubkey.asc', gpg.homedir) msg = open(get_gpg_file('signed_message-expired.txt'), 'rb').read() msg_sig = open(get_gpg_file('signed_message-expired.txt.sig'), 'rb').read() @@ -92,7 +92,7 @@ def test_gpg_verify_expired(): @raises(SignedWithWrongKey) def test_gpg_verify_wrong_key(): - gpg = GnuPG() + gpg = GnuPG(debug=True) import_key('gpgsync_test_pubkey.asc', gpg.homedir) import_key('pgpsync_multiple_uids.asc', gpg.homedir) msg = open(get_gpg_file('signed_message-valid.txt'), 'rb').read() @@ -100,7 +100,7 @@ def test_gpg_verify_wrong_key(): gpg.verify(msg_sig, msg, b'D86B4D4BB5DFDD378B58D4D3F121AC6230396C33') def test_gpg_list_all_keyids(): - gpg = GnuPG() + gpg = GnuPG(debug=True) import_key('gpgsync_test_pubkey.asc', gpg.homedir) key1_fp = common.clean_fp(b'3B72C32B49CBB5BBDD57440E1D07D43448FB8382') @@ -113,7 +113,7 @@ def test_gpg_list_all_keyids(): def test_gpg_export_pubkey_to_disk(): appdata = tempfile.TemporaryDirectory() - gpg = GnuPG(appdata_path=appdata.name) + gpg = GnuPG(appdata_path=appdata.name, debug=True) fp = b'3B72C32B49CBB5BBDD57440E1D07D43448FB8382' filename = gpg.get_pubkey_filename_on_disk(fp) @@ -133,7 +133,7 @@ def test_gpg_export_pubkey_to_disk(): def test_gpg_import_pubkey_from_disk(): appdata = tempfile.TemporaryDirectory() - gpg = GnuPG(appdata_path=appdata.name) + gpg = GnuPG(appdata_path=appdata.name, debug=True) fp = b'3B72C32B49CBB5BBDD57440E1D07D43448FB8382' filename = gpg.get_pubkey_filename_on_disk(fp) @@ -153,7 +153,7 @@ def test_gpg_import_pubkey_from_disk(): def test_gpg_delete_pubkey_from_disk(): appdata = tempfile.TemporaryDirectory() - gpg = GnuPG(appdata_path=appdata.name) + gpg = GnuPG(appdata_path=appdata.name, debug=True) fp = b'3B72C32B49CBB5BBDD57440E1D07D43448FB8382' filename = gpg.get_pubkey_filename_on_disk(fp)