aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_x509.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2015-10-24 18:32:10 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2015-10-24 18:32:10 -0400
commit9442fa9afab67146c02a994463186b7c09908f77 (patch)
tree5d5422fa7c83d2d897fa630286c4048be8cb82cf /tests/test_x509.py
parent95080e9fdac5865dfc5977051c20c6ef1aec0f17 (diff)
downloadcryptography-9442fa9afab67146c02a994463186b7c09908f77.tar.gz
cryptography-9442fa9afab67146c02a994463186b7c09908f77.tar.bz2
cryptography-9442fa9afab67146c02a994463186b7c09908f77.zip
Fixed #2444 -- added an __hash__ to x509 Names
Diffstat (limited to 'tests/test_x509.py')
-rw-r--r--tests/test_x509.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py
index cb05daf0..e7de2efd 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_hah(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'),