mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-15 07:18:09 -04:00
Call Deskpro ticket when there is an error
This commit is contained in:
@@ -517,6 +517,13 @@ def letter_raise_alert_if_no_ack_file_for_zip():
|
|||||||
zip_not_today.append(s[0])
|
zip_not_today.append(s[0])
|
||||||
|
|
||||||
if zip_file_list:
|
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)
|
raise NoAckFileReceived(message=zip_file_list)
|
||||||
|
|
||||||
if zip_not_today:
|
if zip_not_today:
|
||||||
|
|||||||
@@ -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",
|
mock_get_file = mocker.patch("app.aws.s3.get_s3_file",
|
||||||
return_value='NOTIFY.20180111175007.ZIP|20180111175733\n'
|
return_value='NOTIFY.20180111175007.ZIP|20180111175733\n'
|
||||||
'NOTIFY.20180111175008.ZIP|20180111175734')
|
'NOTIFY.20180111175008.ZIP|20180111175734')
|
||||||
|
mock_deskpro = mocker.patch("app.celery.scheduled_tasks.deskpro_client.create_ticket")
|
||||||
|
|
||||||
with pytest.raises(expected_exception=NoAckFileReceived) as e:
|
with pytest.raises(expected_exception=NoAckFileReceived) as e:
|
||||||
letter_raise_alert_if_no_ack_file_for_zip()
|
letter_raise_alert_if_no_ack_file_for_zip()
|
||||||
|
|
||||||
assert e.value.message == ['NOTIFY.20180111175009.ZIP', 'NOTIFY.20180111175010.ZIP']
|
assert e.value.message == ['NOTIFY.20180111175009.ZIP', 'NOTIFY.20180111175010.ZIP']
|
||||||
assert mock_file_list.call_count == 2
|
assert mock_file_list.call_count == 2
|
||||||
assert mock_get_file.call_count == 1
|
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')
|
@freeze_time('2018-01-11T23:00:00')
|
||||||
|
|||||||
Reference in New Issue
Block a user