summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMathias Ertl <mati@er.tl>2021-02-15 22:11:50 +0100
committerGitHub <noreply@github.com>2021-02-15 16:11:50 -0500
commit96801ff92e861c8ee333c14afda691d1025e5e8f (patch)
treebf7e8a1d2341904ba1298cd8744934313307acb9 /tests
parenta15b5808ebc80da42d6c54663eb8070141343eb6 (diff)
downloadcryptography-96801ff92e861c8ee333c14afda691d1025e5e8f.tar.gz
add typehints for read only properties (#5826)
* add typehints for read only properties * fix typing in test cases * fix last missing assertion * add typehints to all read_only_properties where type hints are already available * check for isnot None instead, as per PR suggestion * convert read_only_property to @property decorators * remove unused import * use List instead of Iterable for return values * use @property instead of read_only_property * fix type errors * remove last occurance of annotated read_only_property * use is not None check (works because we now return list) * fix unused import
Diffstat (limited to 'tests')
-rw-r--r--tests/x509/test_x509_crlbuilder.py1
-rw-r--r--tests/x509/test_x509_ext.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/x509/test_x509_crlbuilder.py b/tests/x509/test_x509_crlbuilder.py
index cbf0b073b..88725710d 100644
--- a/tests/x509/test_x509_crlbuilder.py
+++ b/tests/x509/test_x509_crlbuilder.py
@@ -366,6 +366,7 @@ class TestCertificateRevocationListBuilder(object):
ext1 = crl.extensions.get_extension_for_class(x509.FreshestCRL)
assert ext1.critical is False
assert isinstance(ext1.value[0], x509.DistributionPoint)
+ assert ext1.value[0].full_name is not None
uri = ext1.value[0].full_name[0]
assert isinstance(uri, x509.UniformResourceIdentifier)
assert uri.value == "http://d.om/delta"
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py
index b8f226d5f..41a35e264 100644
--- a/tests/x509/test_x509_ext.py
+++ b/tests/x509/test_x509_ext.py
@@ -517,6 +517,7 @@ class TestPolicyInformation(object):
def test_iter_input(self):
qual = ["foo", "bar"]
pi = x509.PolicyInformation(x509.ObjectIdentifier("1.2.3"), iter(qual))
+ assert pi.policy_qualifiers is not None
assert list(pi.policy_qualifiers) == qual
def test_repr(self):
@@ -1104,6 +1105,7 @@ class TestAuthorityKeyIdentifier(object):
)
]
aki = x509.AuthorityKeyIdentifier(b"digest", iter(dirnames), 1234)
+ assert aki.authority_cert_issuer is not None
assert list(aki.authority_cert_issuer) == dirnames
def test_repr(self):
@@ -3429,7 +3431,9 @@ class TestNameConstraints(object):
def test_iter_input(self):
subtrees = [x509.IPAddress(ipaddress.IPv4Network("192.168.0.0/24"))]
nc = x509.NameConstraints(iter(subtrees), iter(subtrees))
+ assert nc.permitted_subtrees is not None
assert list(nc.permitted_subtrees) == subtrees
+ assert nc.excluded_subtrees is not None
assert list(nc.excluded_subtrees) == subtrees
def test_repr(self):
@@ -3781,7 +3785,9 @@ class TestDistributionPoint(object):
frozenset([x509.ReasonFlags.ca_compromise]),
iter(issuer),
)
+ assert dp.full_name is not None
assert list(dp.full_name) == name
+ assert dp.crl_issuer is not None
assert list(dp.crl_issuer) == issuer
def test_repr(self):