Skip to content

Commit

Permalink
Merge pull request #605 from oda-hub/removed-matrix-keys-exception-pa…
Browse files Browse the repository at this point in the history
…yload

removed matrix keys and additional test
  • Loading branch information
burnout87 authored Oct 18, 2023
2 parents fac1cac + df609f8 commit 4ff6ba2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cdci_data_analysis/flask_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
}

Expand Down
40 changes: 40 additions & 0 deletions tests/test_server_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4ff6ba2

Please sign in to comment.