Grammar change to despro ticket

Grammar change to despro ticket
Strip sets of empty elements
Strip subfolder in returned zip file list
ar change to despro ticket
This commit is contained in:
venusbb
2018-01-22 13:11:47 +00:00
parent cf30e69e8c
commit 2edb0c0883
2 changed files with 8 additions and 5 deletions

View File

@@ -500,7 +500,9 @@ def letter_raise_alert_if_no_ack_file_for_zip():
for key in s3.get_list_of_files_by_suffix(bucket_name=current_app.config['LETTERS_PDF_BUCKET_NAME'], for key in s3.get_list_of_files_by_suffix(bucket_name=current_app.config['LETTERS_PDF_BUCKET_NAME'],
subfolder=datetime.utcnow().strftime('%Y-%m-%d') + '/zips_sent', subfolder=datetime.utcnow().strftime('%Y-%m-%d') + '/zips_sent',
suffix='.TXT'): suffix='.TXT'):
zip_file_set.add(key.upper().rstrip('.TXT'))
subname = key.split('/')[-1] # strip subfolder in name
zip_file_set.add(subname.upper().rstrip('.TXT'))
# get acknowledgement file # get acknowledgement file
ack_file_set = set() ack_file_set = set()
@@ -521,16 +523,17 @@ def letter_raise_alert_if_no_ack_file_for_zip():
s = zip_file.split('|') s = zip_file.split('|')
ack_content_set.add(s[0].upper()) ack_content_set.add(s[0].upper())
deskpro_message = "Letter ack does not contains all zip files sent. " \ deskpro_message = "Letter ack file does not contains all zip files sent. " \
"Missing ack for zip files: {}, " \ "Missing ack for zip files: {}, " \
"pdf bucket: {}, subfolder: {}, " \ "pdf bucket: {}, subfolder: {}, " \
"ack bucket: {}".format(str(zip_file_set - ack_content_set), "ack bucket: {}".format(str(zip_file_set - ack_content_set),
current_app.config['LETTERS_PDF_BUCKET_NAME'], current_app.config['LETTERS_PDF_BUCKET_NAME'],
datetime.utcnow().strftime('%Y-%m-%d') + '/zips_sent', datetime.utcnow().strftime('%Y-%m-%d') + '/zips_sent',
current_app.config['DVLA_RESPONSE_BUCKET_NAME']) current_app.config['DVLA_RESPONSE_BUCKET_NAME'])
# strip empty element before comparison
ack_content_set.discard('')
zip_file_set.discard('')
if current_app.config['NOTIFY_ENVIRONMENT'] in ['production', 'test']: if current_app.config['NOTIFY_ENVIRONMENT'] in ['production', 'test']:
if len(zip_file_set - ack_content_set) > 0: if len(zip_file_set - ack_content_set) > 0:
deskpro_client.create_ticket( deskpro_client.create_ticket(
subject="Letter acknowledge error", subject="Letter acknowledge error",

View File

@@ -1158,7 +1158,7 @@ def test_letter_raise_alert_if_ack_files_not_match_zip_list(mocker, notify_db):
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
deskpro_message = "Letter ack does not contains all zip files sent. " \ deskpro_message = "Letter ack file does not contains all zip files sent. " \
"Missing ack for zip files: {}, " \ "Missing ack for zip files: {}, " \
"pdf bucket: {}, subfolder: {}, " \ "pdf bucket: {}, subfolder: {}, " \
"ack bucket: {}".format(str(set(['NOTIFY.20180111175009.ZIP', 'NOTIFY.20180111175010.ZIP'])), "ack bucket: {}".format(str(set(['NOTIFY.20180111175009.ZIP', 'NOTIFY.20180111175010.ZIP'])),