diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-10-24 19:02:08 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-10-24 19:02:08 -0500 |
commit | b7ee910c2070a3e5d8d64ac17ceaa5793f114dc1 (patch) | |
tree | effdff93a30a4420b105030b30d7beb4e31067d9 /tests | |
parent | 95080e9fdac5865dfc5977051c20c6ef1aec0f17 (diff) | |
parent | 1aecec7012b554fef96a543e1c0581e00de53583 (diff) | |
download | cryptography-b7ee910c2070a3e5d8d64ac17ceaa5793f114dc1.tar.gz cryptography-b7ee910c2070a3e5d8d64ac17ceaa5793f114dc1.tar.bz2 cryptography-b7ee910c2070a3e5d8d64ac17ceaa5793f114dc1.zip |
Merge pull request #2445 from alex/name-hash
Fixed #2444 -- added an __hash__ to x509 Names
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_x509.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py index cb05daf0..b9ea139b 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -2755,6 +2755,23 @@ class TestName(object): assert name1 != name2 assert name1 != object() + def test_hash(self): + name1 = x509.Name([ + x509.NameAttribute(x509.ObjectIdentifier('oid'), u'value1'), + x509.NameAttribute(x509.ObjectIdentifier('oid2'), u'value2'), + ]) + name2 = x509.Name([ + x509.NameAttribute(x509.ObjectIdentifier('oid'), u'value1'), + x509.NameAttribute(x509.ObjectIdentifier('oid2'), u'value2'), + ]) + name3 = x509.Name([ + x509.NameAttribute(x509.ObjectIdentifier('oid2'), u'value2'), + x509.NameAttribute(x509.ObjectIdentifier('oid'), u'value1'), + ]) + + assert hash(name1) == hash(name2) + assert hash(name1) != hash(name3) + def test_repr(self): name = x509.Name([ x509.NameAttribute(NameOID.COMMON_NAME, u'cryptography.io'), |