From 4f776807ada7f417a2a7f867c395449b3c945d92 Mon Sep 17 00:00:00 2001 From: burnout87 Date: Thu, 19 Oct 2023 19:49:46 +0200 Subject: [PATCH] matrix message content --- cdci_data_analysis/flask_app/dispatcher_query.py | 10 +++++++++- tests/test_job_management.py | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cdci_data_analysis/flask_app/dispatcher_query.py b/cdci_data_analysis/flask_app/dispatcher_query.py index 0a879f6f4..edccfcdf7 100644 --- a/cdci_data_analysis/flask_app/dispatcher_query.py +++ b/cdci_data_analysis/flask_app/dispatcher_query.py @@ -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/*')): @@ -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 diff --git a/tests/test_job_management.py b/tests/test_job_management.py index 620a1ea57..8c2990d74 100644 --- a/tests/test_job_management.py +++ b/tests/test_job_management.py @@ -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):