Merge pull request #1184 from dod-ccpo/fix-crl-test-bug

Fix bug in static CRL test.
This commit is contained in:
dandds 2019-11-14 16:11:29 -05:00 committed by GitHub
commit a0e2332b05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,8 +126,25 @@ def test_throws_error_for_missing_issuer(app):
assert DOD_CN in message assert DOD_CN in message
FIXTURE_CRL_CACHE = "tests/fixtures/chain/crl_locations.json"
def setup_function(test_multistep_certificate_chain):
if os.path.isfile(FIXTURE_CRL_CACHE):
os.remove(FIXTURE_CRL_CACHE)
def test_multistep_certificate_chain(): def test_multistep_certificate_chain():
cache = CRLCache("tests/fixtures/chain/ca-chain.pem", "tests/fixtures/chain/") issuer = None
fixture_crl = "tests/fixtures/chain/intermediate.crl"
with open(fixture_crl, "rb") as crl_file:
crl = crypto.load_crl(crypto.FILETYPE_ASN1, crl_file.read())
issuer = crl.get_issuer().der()
crl_list = [(fixture_crl, issuer.hex())]
cache = CRLCache(
"tests/fixtures/chain/ca-chain.pem", "tests/fixtures/chain/", crl_list=crl_list
)
cert = open("tests/fixtures/chain/client.crt", "rb").read() cert = open("tests/fixtures/chain/client.crt", "rb").read()
assert cache.crl_check(cert) assert cache.crl_check(cert)