aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_x509.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-12-21 09:25:36 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-12-21 09:25:36 -0600
commit2c91858de5fca63ee56b342d44fee73ed220d547 (patch)
tree8410ea4591acccad1ce1f810c13c350279ea82d1 /tests/test_x509.py
parent2d1d24dd718dcb044087d814a54168f060f40e69 (diff)
downloadcryptography-2c91858de5fca63ee56b342d44fee73ed220d547.tar.gz
cryptography-2c91858de5fca63ee56b342d44fee73ed220d547.tar.bz2
cryptography-2c91858de5fca63ee56b342d44fee73ed220d547.zip
add test for byte matching
Diffstat (limited to 'tests/test_x509.py')
-rw-r--r--tests/test_x509.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py
index fecafecc..27ce21e2 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -254,6 +254,30 @@ class TestCertificateRevocationList(object):
assert crl.last_update == datetime.datetime(2015, 1, 1, 0, 0, 0)
assert crl.next_update == datetime.datetime(2016, 1, 1, 0, 0, 0)
+ @pytest.mark.parametrize(
+ ("cert_path", "loader_func", "encoding"),
+ [
+ (
+ os.path.join("x509", "custom", "crl_all_reasons.pem"),
+ x509.load_pem_x509_crl,
+ serialization.Encoding.PEM,
+ ),
+ (
+ os.path.join("x509", "PKITS_data", "crls", "GoodCACRL.crl"),
+ x509.load_der_x509_crl,
+ serialization.Encoding.DER,
+ ),
+ ]
+ )
+ def test_public_bytes_match(self, cert_path, loader_func, encoding,
+ backend):
+ crl_bytes = load_vectors_from_file(
+ cert_path, lambda pemfile: pemfile.read(), mode="rb"
+ )
+ crl = loader_func(crl_bytes, backend)
+ serialized = crl.public_bytes(encoding)
+ assert serialized == crl_bytes
+
def test_public_bytes_invalid_encoding(self, backend):
crl = _load_cert(
os.path.join("x509", "custom", "crl_empty.pem"),