diff --git a/app/celery/tasks.py b/app/celery/tasks.py index 36984ff5a..dd37229f1 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -487,7 +487,7 @@ def record_daily_sorted_counts(self, filename): ) raise DVLAException(message) - billing_date = get_billing_date_in_est_from_filename(filename) + billing_date = get_local_billing_date_from_filename(filename) persist_daily_sorted_letter_counts(day=billing_date, file_name=filename, sorted_letter_counts=sorted_letter_counts) @@ -503,7 +503,7 @@ def parse_dvla_file(filename): raise DVLAException('DVLA response file: {} has an invalid format'.format(filename)) -def get_billing_date_in_est_from_filename(filename): +def get_local_billing_date_from_filename(filename): # exclude seconds from the date since we don't need it. We got a date ending in 60 second - which is not valid. datetime_string = filename.split('-')[1][:-2] datetime_obj = datetime.strptime(datetime_string, '%Y%m%d%H%M') diff --git a/tests/app/celery/test_ftp_update_tasks.py b/tests/app/celery/test_ftp_update_tasks.py index 834985d3c..d973f7a93 100644 --- a/tests/app/celery/test_ftp_update_tasks.py +++ b/tests/app/celery/test_ftp_update_tasks.py @@ -8,7 +8,7 @@ from freezegun import freeze_time from app.celery.tasks import ( check_billable_units, - get_billing_date_in_est_from_filename, + get_local_billing_date_from_filename, persist_daily_sorted_letter_counts, process_updates_from_file, record_daily_sorted_counts, @@ -236,9 +236,9 @@ def test_check_billable_units_when_billable_units_does_not_match_page_count( ('20170820000000', date(2017, 8, 19)), ('20170120230000', date(2017, 1, 20)) ]) -def test_get_billing_date_in_est_from_filename(filename_date, billing_date): +def test_get_local_billing_date_from_filename(filename_date, billing_date): filename = 'NOTIFY-{}-RSP.TXT'.format(filename_date) - result = get_billing_date_in_est_from_filename(filename) + result = get_local_billing_date_from_filename(filename) assert result == billing_date