Use pytest fixture for app with non default configs
This commit is contained in:
parent
a1ebedb382
commit
5782c30a7d
@ -164,6 +164,13 @@ def queue():
|
|||||||
atst_queue.get_queue().empty()
|
atst_queue.get_queue().empty()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def crl_failover_open_app(app):
|
||||||
|
app.config.update({"CRL_FAIL_OPEN": True})
|
||||||
|
yield app
|
||||||
|
app.config.update({"CRL_FAIL_OPEN": False})
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def rsa_key():
|
def rsa_key():
|
||||||
def _rsa_key():
|
def _rsa_key():
|
||||||
|
@ -132,7 +132,7 @@ def test_no_op_crl_cache_logs_common_name():
|
|||||||
|
|
||||||
|
|
||||||
def test_expired_crl_raises_CRLInvalidException_with_failover_config_false(
|
def test_expired_crl_raises_CRLInvalidException_with_failover_config_false(
|
||||||
app, ca_file, expired_crl_file, ca_key, make_x509, rsa_key, monkeypatch
|
app, ca_file, expired_crl_file, ca_key, make_x509, rsa_key
|
||||||
):
|
):
|
||||||
app.config.update({"CRL_FAIL_OPEN": False})
|
app.config.update({"CRL_FAIL_OPEN": False})
|
||||||
client_cert = make_x509(rsa_key(), signer_key=ca_key, cn="chewbacca")
|
client_cert = make_x509(rsa_key(), signer_key=ca_key, cn="chewbacca")
|
||||||
@ -143,15 +143,13 @@ def test_expired_crl_raises_CRLInvalidException_with_failover_config_false(
|
|||||||
|
|
||||||
|
|
||||||
def test_expired_crl_passes_with_failover_config_true(
|
def test_expired_crl_passes_with_failover_config_true(
|
||||||
ca_file, expired_crl_file, ca_key, make_x509, rsa_key, monkeypatch, app
|
ca_file, expired_crl_file, ca_key, make_x509, rsa_key, crl_failover_open_app
|
||||||
):
|
):
|
||||||
app.config.update({"CRL_FAIL_OPEN": True})
|
|
||||||
client_cert = make_x509(rsa_key(), signer_key=ca_key, cn="chewbacca")
|
client_cert = make_x509(rsa_key(), signer_key=ca_key, cn="chewbacca")
|
||||||
client_pem = client_cert.public_bytes(Encoding.PEM)
|
client_pem = client_cert.public_bytes(Encoding.PEM)
|
||||||
crl_cache = CRLCache(ca_file, crl_locations=[expired_crl_file])
|
crl_cache = CRLCache(ca_file, crl_locations=[expired_crl_file])
|
||||||
|
|
||||||
assert crl_cache.crl_check(client_pem)
|
assert crl_cache.crl_check(client_pem)
|
||||||
app.config.update({"CRL_FAIL_OPEN": False})
|
|
||||||
|
|
||||||
|
|
||||||
def test_updates_expired_certs(
|
def test_updates_expired_certs(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user