diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-12-26 14:46:58 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-12-26 14:46:58 -0600 |
commit | 8adb59643b7c1219cd286c53243a401b1da0f285 (patch) | |
tree | 8588250d5c7999fecca72b00faa57b34014842c6 /tests | |
parent | 3bcd2d778f91e10a78ec5af3b53abbbc388fd7c2 (diff) | |
download | cryptography-8adb59643b7c1219cd286c53243a401b1da0f285.tar.gz cryptography-8adb59643b7c1219cd286c53243a401b1da0f285.tar.bz2 cryptography-8adb59643b7c1219cd286c53243a401b1da0f285.zip |
support indexing on GeneralNames and SubjectAlternativeName
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_x509_ext.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index a12a48fc..e7252623 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -1483,6 +1483,19 @@ class TestGeneralNames(object): x509.DNSName(u"crypto.local"), ] + def test_indexing(self): + gn = x509.GeneralNames([ + x509.DNSName(u"cryptography.io"), + x509.DNSName(u"crypto.local"), + x509.DNSName(u"another.local"), + x509.RFC822Name(u"email@another.local"), + x509.UniformResourceIdentifier(u"http://another.local"), + ]) + assert gn[-1] == gn[4] + assert len(gn[1:3]) == 2 + assert gn[2:4][0] == gn[2] + assert gn[2:5:2][1] == gn[4] + def test_invalid_general_names(self): with pytest.raises(TypeError): x509.GeneralNames( @@ -1637,6 +1650,19 @@ class TestSubjectAlternativeName(object): x509.DNSName(u"crypto.local"), ] + def test_indexing(self): + san = x509.SubjectAlternativeName([ + x509.DNSName(u"cryptography.io"), + x509.DNSName(u"crypto.local"), + x509.DNSName(u"another.local"), + x509.RFC822Name(u"email@another.local"), + x509.UniformResourceIdentifier(u"http://another.local"), + ]) + assert san[-1] == san[4] + assert len(san[1:3]) == 2 + assert san[2:4][0] == san[2] + assert san[2:5:2][1] == san[4] + def test_invalid_general_names(self): with pytest.raises(TypeError): x509.SubjectAlternativeName( |