Merge pull request #1172 from dod-ccpo/crl-storage-container
Create CRL_STORAGE_CONTAINER if it does not exist.
This commit is contained in:
commit
0cee3c9959
10
atst/app.py
10
atst/app.py
@ -246,11 +246,11 @@ def make_crl_validator(app):
|
|||||||
if app.config.get("DISABLE_CRL_CHECK"):
|
if app.config.get("DISABLE_CRL_CHECK"):
|
||||||
app.crl_cache = NoOpCRLCache(logger=app.logger)
|
app.crl_cache = NoOpCRLCache(logger=app.logger)
|
||||||
else:
|
else:
|
||||||
app.crl_cache = CRLCache(
|
crl_dir = app.config["CRL_STORAGE_CONTAINER"]
|
||||||
app.config["CA_CHAIN"],
|
if not os.path.isdir(crl_dir):
|
||||||
app.config["CRL_STORAGE_CONTAINER"],
|
os.makedirs(crl_dir, exist_ok=True)
|
||||||
logger=app.logger,
|
|
||||||
)
|
app.crl_cache = CRLCache(app.config["CA_CHAIN"], crl_dir, logger=app.logger,)
|
||||||
|
|
||||||
|
|
||||||
def make_mailer(app):
|
def make_mailer(app):
|
||||||
|
24
tests/test_app.py
Normal file
24
tests/test_app.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from atst.app import make_crl_validator
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def replace_crl_dir_config(app):
|
||||||
|
original = app.config.get("CRL_STORAGE_CONTAINER")
|
||||||
|
|
||||||
|
def _replace_crl_dir_config(crl_dir):
|
||||||
|
app.config.update({"CRL_STORAGE_CONTAINER": crl_dir})
|
||||||
|
|
||||||
|
yield _replace_crl_dir_config
|
||||||
|
|
||||||
|
app.config.update({"CRL_STORAGE_CONTAINER": original})
|
||||||
|
|
||||||
|
|
||||||
|
def test_make_crl_validator_creates_crl_dir(app, tmpdir, replace_crl_dir_config):
|
||||||
|
crl_dir = tmpdir.join("new_crl_dir")
|
||||||
|
replace_crl_dir_config(crl_dir)
|
||||||
|
make_crl_validator(app)
|
||||||
|
assert os.path.isdir(crl_dir)
|
Loading…
x
Reference in New Issue
Block a user