diff --git a/app/celery/scheduled_tasks.py b/app/celery/scheduled_tasks.py index 81f38ca29..7ce16e01f 100644 --- a/app/celery/scheduled_tasks.py +++ b/app/celery/scheduled_tasks.py @@ -517,6 +517,13 @@ def letter_raise_alert_if_no_ack_file_for_zip(): zip_not_today.append(s[0]) if zip_file_list: + deskpro_client.create_ticket( + subject="Letter acknowledge error", + message="Letter acknowledgement file do not contains all zip files sent: {}".format(datetime.utcnow() + .strftime('%Y-%m-%d')), + ticket_type='alert' + ) + raise NoAckFileReceived(message=zip_file_list) if zip_not_today: diff --git a/tests/app/celery/test_scheduled_tasks.py b/tests/app/celery/test_scheduled_tasks.py index ac8b65d83..bbea1ad5d 100644 --- a/tests/app/celery/test_scheduled_tasks.py +++ b/tests/app/celery/test_scheduled_tasks.py @@ -1149,12 +1149,19 @@ def test_letter_not_raise_alert_if_ack_files_not_match_zip_list(mocker, notify_d mock_get_file = mocker.patch("app.aws.s3.get_s3_file", return_value='NOTIFY.20180111175007.ZIP|20180111175733\n' 'NOTIFY.20180111175008.ZIP|20180111175734') + mock_deskpro = mocker.patch("app.celery.scheduled_tasks.deskpro_client.create_ticket") + with pytest.raises(expected_exception=NoAckFileReceived) as e: letter_raise_alert_if_no_ack_file_for_zip() assert e.value.message == ['NOTIFY.20180111175009.ZIP', 'NOTIFY.20180111175010.ZIP'] assert mock_file_list.call_count == 2 assert mock_get_file.call_count == 1 + mock_deskpro.assert_called_once_with( + subject="Letter acknowledge error", + message="Letter acknowledgement file do not contains all zip files sent: 2018-01-11", + ticket_type='alert' + ) @freeze_time('2018-01-11T23:00:00')