Skip to content

Commit 3a18960

Browse files
authored
handle different certificate fields correctly (#176)
1 parent 33594ec commit 3a18960

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/test_bundle.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,14 @@ def test_sign_does_not_produce_root(
105105
bundle = Bundle().from_json(bundle_contents)
106106

107107
# Iterate over our cert chain and check for roots.
108-
certs = bundle.verification_material.x509_certificate_chain
109-
for x509cert in certs.certificates:
108+
if bundle.verification_material.is_set("x509_certificate_chain"):
109+
certs = bundle.verification_material.x509_certificate_chain.certificates
110+
elif bundle.verification_material.is_set("certificate"):
111+
certs = [bundle.verification_material.certificate]
112+
else:
113+
assert False, "expected certs in either `x509_certificate_chain` or `certificate`"
114+
115+
for x509cert in certs:
110116
cert = x509.load_der_x509_certificate(x509cert.raw_bytes)
111117

112118
try:

0 commit comments

Comments
 (0)