From 5c037cc8eb800b0da4a6c475cecbdec3b182422b Mon Sep 17 00:00:00 2001 From: Mathias Ertl Date: Mon, 25 Mar 2019 13:20:55 +0100 Subject: implement eq__, __hash__ and __repr__ for OCSPNoCheck and PrecertPoison (#4819) --- tests/x509/test_x509_ext.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'tests/x509') 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) == '' + 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) == '' + @pytest.mark.requires_backend_interface(interface=RSABackend) @pytest.mark.requires_backend_interface(interface=X509Backend) -- cgit v1.2.3