Change format of the letter response file we expect

We were previously expecting the letter response files to be in the
format of 'NOTIFY.<datetime>.RSP.TXT' but the response files we receive
use '-' in the filenames instead of '.' which was causing an error when
we tried to get the date from the filename.
This commit is contained in:
Katie Smith
2018-03-13 11:47:31 +00:00
parent 79b5a735e2
commit 41a9f5a06e
5 changed files with 20 additions and 20 deletions

View File

@@ -123,7 +123,7 @@ def firetext_callback(notification_id, to):
def create_fake_letter_response_file(self, reference):
now = datetime.utcnow()
dvla_response_data = '{}|Sent|0|Sorted'.format(reference)
upload_file_name = 'NOTIFY.{}.RSP.TXT'.format(now.strftime('%Y%m%d%H%M%S'))
upload_file_name = 'NOTIFY-{}-RSP.TXT'.format(now.strftime('%Y%m%d%H%M%S'))
s3upload(
filedata=dvla_response_data,

View File

@@ -440,7 +440,7 @@ def update_letter_notifications_statuses(self, filename):
def get_billing_date_in_bst_from_filename(filename):
datetime_string = filename.split('.')[1]
datetime_string = filename.split('-')[1]
datetime_obj = datetime.strptime(datetime_string, '%Y%m%d%H%M%S')
return convert_utc_to_bst(datetime_obj).date()