Check startup with retained cohort settings

This commit is contained in:
Angel Capetillo Zavala
2026-11-13 17:47:37 -06:00
parent 06dd74cdb6
commit 6d32115eca
+12
View File
@@ -24,3 +24,15 @@ def test_access_token_is_checked_on_the_server(monkeypatch):
assert app.config['CAMA_COHORT_ACCESS'](request)
with app.test_request_context(headers={'X-Cama-Cohort-Token': 'incorrect'}):
assert not app.config['CAMA_COHORT_ACCESS'](request)
def test_application_starts_with_retained_obsolete_configuration(monkeypatch):
"""Old synthetic settings or a bad token cannot prevent the health endpoint starting."""
monkeypatch.setenv('CAMA_COHORT_SYNTHETIC', '1')
monkeypatch.delenv('CAMA_COHORT_SECRET', raising=False)
monkeypatch.setenv('CAMA_COHORT_ACCESS_TOKEN', 'invalid')
from webapi import create_app
client = create_app().test_client()
assert client.get('/health').get_json() == {'status': 'ok'}
assert client.get('/cama/seguimiento').status_code == 403