Check startup with retained cohort settings
This commit is contained in:
@@ -24,3 +24,15 @@ def test_access_token_is_checked_on_the_server(monkeypatch):
|
|||||||
assert app.config['CAMA_COHORT_ACCESS'](request)
|
assert app.config['CAMA_COHORT_ACCESS'](request)
|
||||||
with app.test_request_context(headers={'X-Cama-Cohort-Token': 'incorrect'}):
|
with app.test_request_context(headers={'X-Cama-Cohort-Token': 'incorrect'}):
|
||||||
assert not app.config['CAMA_COHORT_ACCESS'](request)
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user