aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPhoebe Queen <foibey@gmail.com>2015-08-12 05:00:32 +0100
committerPhoebe Queen <foibey@gmail.com>2015-08-12 05:00:32 +0100
commitecae981f3a17236caee76bc95c5881db0b0d39b3 (patch)
tree3ac9b29dee8e77ab2c6bfb061d662104e798cd70 /tests
parent2cc111a18b615ccf3ecec9fe8918836d498e4b67 (diff)
downloadcryptography-ecae981f3a17236caee76bc95c5881db0b0d39b3.tar.gz
cryptography-ecae981f3a17236caee76bc95c5881db0b0d39b3.tar.bz2
cryptography-ecae981f3a17236caee76bc95c5881db0b0d39b3.zip
added test to raise error
Diffstat (limited to 'tests')
-rw-r--r--tests/test_x509_ext.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index 2d3339c3..040347db 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -832,6 +832,22 @@ class TestExtensions(object):
extensions = cert.extensions
assert len(extensions) == 0
+ def test_no_extensions_get_for_class(self, backend):
+ cert = _load_cert(
+ os.path.join(
+ "x509", "verisign_md2_root.pem"
+ ),
+ x509.load_pem_x509_certificate,
+ backend
+ )
+ ext = cert.extensions
+ assert len(ext) == 0
+ assert list(ext) == []
+ with pytest.raises(x509.ExtensionNotFound) as exc:
+ ext.get_extension_for_class(x509.BasicConstraints)
+
+ assert exc.value.oid == ExtensionOID.BASIC_CONSTRAINTS
+
def test_one_extension_get_for_class(self, backend):
cert = _load_cert(
os.path.join(