def test_roundtrip_works(self): cleartext = 'hello, world' passphrase = 'password1' pubring = os.path.join(self.gpghome, 'pubring.gpg') secring = os.path.join(self.gpghome, 'secring.gpg') keyring = obnamlib.Keyring(cat(pubring)) seckeys = obnamlib.SecretKeyring(cat(secring)) encrypted = obnamlib.encrypt_with_keyring(cleartext, keyring) decrypted = obnamlib.decrypt_with_secret_keys(encrypted, gpghome=self.gpghome) self.assertEqual(decrypted, cleartext)
def test_lists_correct_key(self): keyid1 = '3B1802F81B321347' keyid2 = 'DF3D13AA11E69900' seckeys = obnamlib.SecretKeyring(cat('test-gpghome/secring.gpg')) self.assertEqual(sorted(seckeys.keyids()), sorted([keyid1, keyid2]))