diff --git a/cdci_data_analysis/flask_app/app.py b/cdci_data_analysis/flask_app/app.py index 5e928d945..5da20d59c 100644 --- a/cdci_data_analysis/flask_app/app.py +++ b/cdci_data_analysis/flask_app/app.py @@ -221,6 +221,8 @@ def common_exception_payload(): 'dispatcher-config': remove_nested_keys(app.config['conf'].as_dict(), ['sentry_url', 'logstash_host', 'logstash_port','secret_key', 'product_gallery_secret_key', + 'matrix_sender_access_token', 'matrix_incident_report_sender_personal_access_token', + 'matrix_bcc_receivers_room_ids', 'matrix_incident_report_receivers_room_ids', 'smtp_server_password']) } diff --git a/tests/test_server_basic.py b/tests/test_server_basic.py index c81089d82..04f9a313e 100644 --- a/tests/test_server_basic.py +++ b/tests/test_server_basic.py @@ -193,6 +193,46 @@ def test_no_debug_mode_empty_request(dispatcher_live_fixture_no_debug_mode): logger.info(jdata['config']) +def test_matrix_options_mode_empty_request(dispatcher_live_fixture_with_matrix_options): + server = dispatcher_live_fixture_with_matrix_options + print("constructed server:", server) + + c=requests.get(os.path.join(server, "run_analysis"), + params={}, + ) + + print("content:", c.text) + + jdata=c.json() + + assert c.status_code == 400 + + assert sorted(jdata['installed_instruments']) == sorted( + ['empty', 'empty-async', 'empty-semi-async', 'empty-development']) or \ + jdata['installed_instruments'] == [] + + # assert jdata['debug_mode'] == "no" + assert 'dispatcher-config' in jdata['config'] + + dispatcher_config = jdata['config']['dispatcher-config'] + + assert 'origin' in dispatcher_config + + assert 'sentry_url' not in dispatcher_config['cfg_dict']['dispatcher'] + assert 'logstash_port' not in dispatcher_config['cfg_dict']['dispatcher'] + assert 'logstash_host' not in dispatcher_config['cfg_dict']['dispatcher'] + assert 'secret_key' not in dispatcher_config['cfg_dict']['dispatcher'] + assert 'smtp_server_password' not in dispatcher_config['cfg_dict']['dispatcher'] + assert 'products_url' in dispatcher_config['cfg_dict']['dispatcher'] + + assert 'matrix_sender_access_token' not in dispatcher_config['cfg_dict']['dispatcher'] + assert 'matrix_incident_report_sender_personal_access_token' not in dispatcher_config['cfg_dict']['dispatcher'] + assert 'matrix_bcc_receivers_room_ids' not in dispatcher_config['cfg_dict']['dispatcher'] + assert 'matrix_incident_report_receivers_room_ids' not in dispatcher_config['cfg_dict']['dispatcher'] + + logger.info(jdata['config']) + + @pytest.mark.fast def test_same_request_different_users(dispatcher_live_fixture): server = dispatcher_live_fixture