Skip to content

Commit

Permalink
Merge pull request #606 from oda-hub/matrix_history-inspect_state-output
Browse files Browse the repository at this point in the history
matrix message content
  • Loading branch information
burnout87 authored Oct 19, 2023
2 parents 4ff6ba2 + 4f77680 commit a3a1e09
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cdci_data_analysis/flask_app/dispatcher_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ def read_scratch_dir(scratch_dir):
if 'token' in result['analysis_parameters']:
result['analysis_parameters']['token'] = tokenHelper.get_decoded_token(
result['analysis_parameters']['token'], secret_key=None, validate_token=False)
result['analysis_parameters']['email_history'] = []

result['analysis_parameters']['email_history'] = []
for email in glob.glob(os.path.join(scratch_dir, 'email_history/*')):
Expand All @@ -515,6 +514,15 @@ def read_scratch_dir(scratch_dir):
fn=email,
))

result['analysis_parameters']['matrix_message_history'] = []
for msg in glob.glob(os.path.join(scratch_dir, 'matrix_message_history/*')):
ctime = os.stat(msg).st_ctime,
result['analysis_parameters']['matrix_message_history'].append(dict(
ctime=ctime,
ctime_isot=time_.strftime("%Y-%m-%dT%H:%M:%S", time_.gmtime(os.stat(msg).st_ctime)),
fn=msg,
))

result['analysis_parameters']['fits_files'] = []
for fits_fn in glob.glob(os.path.join(scratch_dir, '*fits*')):
ctime = os.stat(fits_fn).st_ctime
Expand Down
6 changes: 6 additions & 0 deletions tests/test_job_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -2563,6 +2563,12 @@ def test_inspect_status(dispatcher_live_fixture, request_cred, roles):
assert jdata['records'][0]['ctime'] == scratch_dir_ctime
assert jdata['records'][0]['mtime'] == scratch_dir_mtime

assert 'email_history' in jdata['records'][0]['analysis_parameters']
assert 'matrix_message_history' in jdata['records'][0]['analysis_parameters']

assert len(jdata['records'][0]['analysis_parameters']['email_history']) == 0
assert len(jdata['records'][0]['analysis_parameters']['matrix_message_history']) == 0


@pytest.mark.parametrize("request_cred", ['public', 'valid_token', 'invalid_token'])
def test_incident_report(dispatcher_live_fixture, dispatcher_local_mail_server, dispatcher_test_conf, request_cred):
Expand Down

0 comments on commit a3a1e09

Please sign in to comment.