aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-09-22 21:29:36 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2017-09-22 09:29:36 -0400
commit5e3cc98473ad54db390736ac81bb74210e85056d (patch)
treed8e0d5e03aee005dc0205661e55d785625b9a71f /tests
parent2fc5849960032a246f869ed1a5d7597d64169cfa (diff)
downloadcryptography-5e3cc98473ad54db390736ac81bb74210e85056d.tar.gz
cryptography-5e3cc98473ad54db390736ac81bb74210e85056d.tar.bz2
cryptography-5e3cc98473ad54db390736ac81bb74210e85056d.zip
support delta crl indicator extension (#3936)
This is an extension for CRLs
Diffstat (limited to 'tests')
-rw-r--r--tests/x509/test_x509.py13
-rw-r--r--tests/x509/test_x509_crlbuilder.py1
-rw-r--r--tests/x509/test_x509_ext.py30
3 files changed, 44 insertions, 0 deletions
diff --git a/tests/x509/test_x509.py b/tests/x509/test_x509.py
index 1833a4a2..d0ce46d8 100644
--- a/tests/x509/test_x509.py
+++ b/tests/x509/test_x509.py
@@ -232,6 +232,19 @@ class TestCertificateRevocationList(object):
x509.UniformResourceIdentifier(b"https://cryptography.io"),
])
+ def test_delta_crl_indicator(self, backend):
+ crl = _load_cert(
+ os.path.join("x509", "custom", "crl_delta_crl_indicator.pem"),
+ x509.load_pem_x509_crl,
+ backend
+ )
+
+ dci = crl.extensions.get_extension_for_oid(
+ ExtensionOID.DELTA_CRL_INDICATOR
+ )
+ assert dci.value == x509.DeltaCRLIndicator(12345678901234567890)
+ assert dci.critical is False
+
def test_signature(self, backend):
crl = _load_cert(
os.path.join("x509", "custom", "crl_all_reasons.pem"),
diff --git a/tests/x509/test_x509_crlbuilder.py b/tests/x509/test_x509_crlbuilder.py
index b90805ff..e90fd3fd 100644
--- a/tests/x509/test_x509_crlbuilder.py
+++ b/tests/x509/test_x509_crlbuilder.py
@@ -209,6 +209,7 @@ class TestCertificateRevocationListBuilder(object):
"extension",
[
x509.CRLNumber(13),
+ x509.DeltaCRLIndicator(12345678901234567890),
x509.AuthorityKeyIdentifier(
b"\xc3\x9c\xf3\xfc\xd3F\x084\xbb\xceF\x7f\xa0|[\xf3\xe2\x08"
b"\xcbY",
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py
index b9400b64..9f0b1b0b 100644
--- a/tests/x509/test_x509_ext.py
+++ b/tests/x509/test_x509_ext.py
@@ -326,6 +326,36 @@ class TestCRLReason(object):
)
+class TestDeltaCRLIndicator(object):
+ def test_not_int(self):
+ with pytest.raises(TypeError):
+ x509.DeltaCRLIndicator("notanint")
+
+ def test_eq(self):
+ delta1 = x509.DeltaCRLIndicator(1)
+ delta2 = x509.DeltaCRLIndicator(1)
+ assert delta1 == delta2
+
+ def test_ne(self):
+ delta1 = x509.DeltaCRLIndicator(1)
+ delta2 = x509.DeltaCRLIndicator(2)
+ assert delta1 != delta2
+ assert delta1 != object()
+
+ def test_repr(self):
+ delta1 = x509.DeltaCRLIndicator(2)
+ assert repr(delta1) == (
+ "<DeltaCRLIndicator(crl_number=2)>"
+ )
+
+ def test_hash(self):
+ delta1 = x509.DeltaCRLIndicator(1)
+ delta2 = x509.DeltaCRLIndicator(1)
+ delta3 = x509.DeltaCRLIndicator(2)
+ assert hash(delta1) == hash(delta2)
+ assert hash(delta1) != hash(delta3)
+
+
class TestInvalidityDate(object):
def test_invalid_invalidity_date(self):
with pytest.raises(TypeError):