don't allow UnrecognizedExtension with get_extension_for_class
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index 7c5ca5f..df796e0 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -1057,6 +1057,11 @@
exts.get_extension_for_class(x509.IssuerAlternativeName)
assert exc.value.oid == ExtensionOID.ISSUER_ALTERNATIVE_NAME
+ def test_unrecognized_extension_for_class(self):
+ exts = x509.Extensions([])
+ with pytest.raises(TypeError):
+ exts.get_extension_for_class(x509.UnrecognizedExtension)
+
def test_indexing(self, backend):
cert = _load_cert(
os.path.join("x509", "cryptography.io.pem"),