aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_x509.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-04-30 16:47:16 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-04-30 16:47:16 -0500
commit8bbdc6f5af5a47bd2b069314c1d3d87da1da1874 (patch)
tree54e5d49e41b97c1fea0251bd8bf47204bbce81a5 /tests/test_x509.py
parentb1501bce9116617ab564c85592d37926c8069b87 (diff)
downloadcryptography-8bbdc6f5af5a47bd2b069314c1d3d87da1da1874.tar.gz
cryptography-8bbdc6f5af5a47bd2b069314c1d3d87da1da1874.tar.bz2
cryptography-8bbdc6f5af5a47bd2b069314c1d3d87da1da1874.zip
add support for equality testing to x509.Certificate
Diffstat (limited to 'tests/test_x509.py')
-rw-r--r--tests/test_x509.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py
index df291de2..8561f1f4 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -313,6 +313,36 @@ class TestRSACertificate(object):
assert exc.value.parsed_version == 7
+ def test_eq(self, backend):
+ cert = _load_cert(
+ os.path.join("x509", "custom", "post2000utctime.pem"),
+ x509.load_pem_x509_certificate,
+ backend
+ )
+ cert2 = _load_cert(
+ os.path.join("x509", "custom", "post2000utctime.pem"),
+ x509.load_pem_x509_certificate,
+ backend
+ )
+ assert cert == cert2
+
+ def test_ne(self, backend):
+ cert = _load_cert(
+ os.path.join("x509", "custom", "post2000utctime.pem"),
+ x509.load_pem_x509_certificate,
+ backend
+ )
+ cert2 = _load_cert(
+ os.path.join(
+ "x509", "PKITS_data", "certs",
+ "ValidGeneralizedTimenotAfterDateTest8EE.crt"
+ ),
+ x509.load_der_x509_certificate,
+ backend
+ )
+ assert cert != cert2
+ assert cert != object()
+
def test_version_1_cert(self, backend):
cert = _load_cert(
os.path.join("x509", "v1_cert.pem"),