diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-05-03 10:04:57 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-05-12 09:13:12 -0500 |
commit | 2ca2eb3cfd2dff414fdf200bd53f5c82f3b6bc9d (patch) | |
tree | 182926594420831326888e28ecf889c208a5be83 /tests/test_x509_ext.py | |
parent | cb599d3be59d05ef102759d02069c50466db869c (diff) | |
download | cryptography-2ca2eb3cfd2dff414fdf200bd53f5c82f3b6bc9d.tar.gz cryptography-2ca2eb3cfd2dff414fdf200bd53f5c82f3b6bc9d.tar.bz2 cryptography-2ca2eb3cfd2dff414fdf200bd53f5c82f3b6bc9d.zip |
add eq/ne methods for AuthorityKeyIdentifier
Diffstat (limited to 'tests/test_x509_ext.py')
-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): |