def test_import_export(self): with pkg_integrity.cli_gpg_ctx() as ctx: err, output = ctx.export_key(KEYID) self.assertTrue(err is not None) err, output = ctx.import_key(KEYID) self.assertTrue(err is None) err, output = ctx.export_key(KEYID) self.assertTrue(err is None) self.assertTrue('PGP PUBLIC KEY' in output)
def test_display_key_info(self): with pkg_integrity.cli_gpg_ctx() as ctx: err, output = ctx.import_key(KEYID) self.assertTrue(err is None) err, output = ctx.export_key(KEYID) with open('key_test.pkey', 'w') as out_key: out_key.write(output) err, output = ctx.display_keyinfo('key_test.pkey') os.remove('key_test.pkey') self.assertTrue('keyid' in output)
def test_import_non_existing_key(self): with pkg_integrity.cli_gpg_ctx() as ctx: keyid = '0' + KEYID[1:] err, output = ctx.import_key(keyid) self.assertTrue(err is not None)