In local development, the app will fail to start if it does not find the directory specified by CRL_STORAGE_CONTAINER. This adds a few lines to safely create that directory on startup and corresponding tests.
25 lines
595 B
Python
25 lines
595 B
Python
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)
|