Add missing test case for `add_key` and `delete_key`

This commit is contained in:
Wiktor Kwapisiewicz 2022-12-23 13:44:13 +01:00
parent 2215886850
commit 46bb125684
Signed by untrusted user: wiktor
GPG Key ID: E68BE3B312FA33FC
1 changed files with 9 additions and 0 deletions

View File

@ -37,6 +37,15 @@ class GnuPGUtilitiesTest(unittest.TestCase):
self.assertDictEqual(keys, known_identities)
def test_add_delete_key(self):
self.assertDictEqual(GnuPG.public_keys('/tmp'), { })
GnuPG.add_key('/tmp', self._load('test/keys/bob@disposlab.pub'))
self.assertDictEqual(GnuPG.public_keys('/tmp'), {
'19CF4B47ECC9C47AFA84D4BD96F39FDA0E31BB67': 'bob@disposlab',
})
GnuPG.delete_key('/tmp', 'bob@disposlab')
self.assertDictEqual(GnuPG.public_keys('/tmp'), { })
def _load(self, filename):
with open(filename) as f:
return f.read()