aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_x509_ext.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-06-21 21:46:41 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-06-21 21:46:41 -0500
commit318942867e04bc1401d8957a51072a4a79a24957 (patch)
tree6cd81b5ef950337acf1630f54c94a7d6cf070053 /tests/test_x509_ext.py
parent9fd9c0c791b5418a919456dd4183a7fd9cdbc919 (diff)
downloadcryptography-318942867e04bc1401d8957a51072a4a79a24957.tar.gz
cryptography-318942867e04bc1401d8957a51072a4a79a24957.tar.bz2
cryptography-318942867e04bc1401d8957a51072a4a79a24957.zip
add eq/ne support to NameConstraints
Diffstat (limited to 'tests/test_x509_ext.py')
-rw-r--r--tests/test_x509_ext.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index a5747c37..cacc0573 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -1972,6 +1972,35 @@ class TestNameConstraints(object):
", <DNSName(value=name2.local)>], excluded_subtrees=None)>"
)
+ def test_eq(self):
+ nc = x509.NameConstraints(
+ permitted_subtrees=[x509.DNSName(u"name.local")],
+ excluded_subtrees=[x509.DNSName(u"name2.local")]
+ )
+ nc2 = x509.NameConstraints(
+ permitted_subtrees=[x509.DNSName(u"name.local")],
+ excluded_subtrees=[x509.DNSName(u"name2.local")]
+ )
+ assert nc == nc2
+
+ def test_ne(self):
+ nc = x509.NameConstraints(
+ permitted_subtrees=[x509.DNSName(u"name.local")],
+ excluded_subtrees=[x509.DNSName(u"name2.local")]
+ )
+ nc2 = x509.NameConstraints(
+ permitted_subtrees=[x509.DNSName(u"name.local")],
+ excluded_subtrees=None
+ )
+ nc3 = x509.NameConstraints(
+ permitted_subtrees=None,
+ excluded_subtrees=[x509.DNSName(u"name2.local")]
+ )
+
+ assert nc != nc2
+ assert nc != nc3
+ assert nc != object()
+
class TestDistributionPoint(object):
def test_distribution_point_full_name_not_general_names(self):