aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-12-26 00:52:58 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-12-26 00:57:39 -0600
commit5b90c97503b2ef2d4e7f69ba41b74e1e6f15b60e (patch)
treea70fd7f2125dcb4a418a5251dd77a3fd0b35b34a /tests
parent4f76921ad87d71067158625aa0afedbba8ae1314 (diff)
downloadcryptography-5b90c97503b2ef2d4e7f69ba41b74e1e6f15b60e.tar.gz
cryptography-5b90c97503b2ef2d4e7f69ba41b74e1e6f15b60e.tar.bz2
cryptography-5b90c97503b2ef2d4e7f69ba41b74e1e6f15b60e.zip
make the Extensions class support indexing
Diffstat (limited to 'tests')
-rw-r--r--tests/test_x509_ext.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index d9743c8e..1144d47a 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -858,6 +858,18 @@ class TestExtensions(object):
exts.get_extension_for_class(x509.IssuerAlternativeName)
assert exc.value.oid == ExtensionOID.ISSUER_ALTERNATIVE_NAME
+ def test_indexing(self, backend):
+ cert = _load_cert(
+ os.path.join("x509", "cryptography.io.pem"),
+ x509.load_pem_x509_certificate,
+ backend
+ )
+ exts = cert.extensions
+ assert exts[-1] == exts[7]
+ assert len(exts[3:5]) == 2
+ assert exts[2:4][0] == exts[2]
+ assert exts[2:4][1] == exts[3]
+
def test_one_extension_get_for_class(self, backend):
cert = _load_cert(
os.path.join(