aboutsummaryrefslogtreecommitdiffstats
path: root/tests/x509
diff options
context:
space:
mode:
authorMathias Ertl <mati@fsinf.at>2019-03-25 13:20:55 +0100
committerPaul Kehrer <paul.l.kehrer@gmail.com>2019-03-25 20:20:55 +0800
commit5c037cc8eb800b0da4a6c475cecbdec3b182422b (patch)
tree099226ae44ba9a806f8e5dd3672815b7ac04625c /tests/x509
parentd21f8815a11972b804a776b4201dc4867bf8ce4c (diff)
downloadcryptography-5c037cc8eb800b0da4a6c475cecbdec3b182422b.tar.gz
cryptography-5c037cc8eb800b0da4a6c475cecbdec3b182422b.tar.bz2
cryptography-5c037cc8eb800b0da4a6c475cecbdec3b182422b.zip
implement eq__, __hash__ and __repr__ for OCSPNoCheck and PrecertPoison (#4819)
Diffstat (limited to 'tests/x509')
-rw-r--r--tests/x509/test_x509_ext.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py
index 6cf388da..fabf4106 100644
--- a/tests/x509/test_x509_ext.py
+++ b/tests/x509/test_x509_ext.py
@@ -4391,6 +4391,28 @@ class TestOCSPNoCheckExtension(object):
)
assert isinstance(ext.value, x509.OCSPNoCheck)
+ def test_eq(self):
+ onc1 = x509.OCSPNoCheck()
+ onc2 = x509.OCSPNoCheck()
+
+ assert onc1 == onc2
+
+ def test_hash(self):
+ onc1 = x509.OCSPNoCheck()
+ onc2 = x509.OCSPNoCheck()
+
+ assert hash(onc1) == hash(onc2)
+
+ def test_ne(self):
+ onc = x509.OCSPNoCheck()
+
+ assert onc != object()
+
+ def test_repr(self):
+ onc = x509.OCSPNoCheck()
+
+ assert repr(onc) == '<OCSPNoCheck()>'
+
class TestInhibitAnyPolicy(object):
def test_not_int(self):
@@ -4894,6 +4916,28 @@ class TestPrecertPoisonExtension(object):
).value
assert isinstance(poison, x509.PrecertPoison)
+ def test_eq(self):
+ pcp1 = x509.PrecertPoison()
+ pcp2 = x509.PrecertPoison()
+
+ assert pcp1 == pcp2
+
+ def test_hash(self):
+ pcp1 = x509.PrecertPoison()
+ pcp2 = x509.PrecertPoison()
+
+ assert hash(pcp1) == hash(pcp2)
+
+ def test_ne(self):
+ pcp = x509.PrecertPoison()
+
+ assert pcp != object()
+
+ def test_repr(self):
+ pcp = x509.PrecertPoison()
+
+ assert repr(pcp) == '<PrecertPoison()>'
+
@pytest.mark.requires_backend_interface(interface=RSABackend)
@pytest.mark.requires_backend_interface(interface=X509Backend)