def check_algo(algo, k_id): with tempfile.NamedTemporaryFile(delete=True) as tmpf: tmpf.write(algo) tmpf.flush() self.assertEqual( pkg_integrity.parse_key(tmpf.name, r'keyid (.+?)\n'), k_id) tmpf.close()
def check_pubkey(algo, email): pattern = r':user ID packet: ".* <(.+?)>"\n' with tempfile.NamedTemporaryFile(delete=True) as tmpf: tmpf.write(algo) tmpf.flush() self.assertEqual(pkg_integrity.parse_key(tmpf.name, pattern), email) tmpf.close()