diff --git a/tests/test_cama_runtime.py b/tests/test_cama_runtime.py index 981188b..3ae7d82 100644 --- a/tests/test_cama_runtime.py +++ b/tests/test_cama_runtime.py @@ -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