def check_get_keyid(algo, key_id): with tempfile.NamedTemporaryFile(delete=True) as tmpf: tmpf.write(algo) tmpf.flush() result = pkg_integrity.get_keyid(tmpf.name) self.assertEqual(result, key_id) tmpf.close()
def test_get_keyid_none(self): false_name = '/false/name' self.assertTrue(pkg_integrity.get_keyid(false_name) is None)
def test_get_keyid_none(self): """Test get_keyid() when the key name is invalid.""" false_name = '/false/name' self.assertTrue(pkg_integrity.get_keyid(false_name) is None)