diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-05-12 11:22:30 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-05-12 11:22:30 -0400 |
commit | cdcd45f0ad8eda3b940ba051555c4465c8b777db (patch) | |
tree | 91a4973eaa5765aad7d6b63e08be3a05424bfa92 /tests | |
parent | 94d78f457a4f58596d597e543ef8a90e1c764c1d (diff) | |
parent | 2ca2eb3cfd2dff414fdf200bd53f5c82f3b6bc9d (diff) | |
download | cryptography-cdcd45f0ad8eda3b940ba051555c4465c8b777db.tar.gz cryptography-cdcd45f0ad8eda3b940ba051555c4465c8b777db.tar.bz2 cryptography-cdcd45f0ad8eda3b940ba051555c4465c8b777db.zip |
Merge pull request #1931 from reaperhulk/aki-eq
add eq/ne methods for AuthorityKeyIdentifier
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_x509_ext.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index f07792d5..a366265c 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -473,6 +473,35 @@ class TestAuthorityKeyIdentifier(object): "])>)>], authority_cert_serial_number=1234)>" ) + def test_eq(self): + dirname = x509.DirectoryName( + x509.Name([x509.NameAttribute(x509.OID_COMMON_NAME, 'myCN')]) + ) + aki = x509.AuthorityKeyIdentifier(b"digest", [dirname], 1234) + dirname2 = x509.DirectoryName( + x509.Name([x509.NameAttribute(x509.OID_COMMON_NAME, 'myCN')]) + ) + aki2 = x509.AuthorityKeyIdentifier(b"digest", [dirname2], 1234) + assert aki == aki2 + + def test_ne(self): + dirname = x509.DirectoryName( + x509.Name([x509.NameAttribute(x509.OID_COMMON_NAME, 'myCN')]) + ) + dirname5 = x509.DirectoryName( + x509.Name([x509.NameAttribute(x509.OID_COMMON_NAME, 'aCN')]) + ) + aki = x509.AuthorityKeyIdentifier(b"digest", [dirname], 1234) + aki2 = x509.AuthorityKeyIdentifier(b"diges", [dirname], 1234) + aki3 = x509.AuthorityKeyIdentifier(b"digest", None, None) + aki4 = x509.AuthorityKeyIdentifier(b"digest", [dirname], 12345) + aki5 = x509.AuthorityKeyIdentifier(b"digest", [dirname5], 12345) + assert aki != aki2 + assert aki != aki3 + assert aki != aki4 + assert aki != aki5 + assert aki != object() + class TestBasicConstraints(object): def test_ca_not_boolean(self): |