atst/tests/test_app.py
dandds 1654d2ea9f Create CRL_STORAGE_CONTAINER if it does not exist.
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.
2019-11-08 06:21:56 -05:00

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)