diff --git a/app/models/contact_list.py b/app/models/contact_list.py index 16ece39e4..870ef80de 100644 --- a/app/models/contact_list.py +++ b/app/models/contact_list.py @@ -4,7 +4,6 @@ from os import path from flask import abort, current_app from notifications_utils.formatters import strip_whitespace from notifications_utils.recipients import RecipientCSV -from notifications_utils.timezones import utc_string_to_aware_gmt_datetime from werkzeug.utils import cached_property from app.models import JSONModel, ModelList @@ -23,6 +22,7 @@ class ContactList(JSONModel): ALLOWED_PROPERTIES = { 'id', + 'created_at', 'created_by', 'has_jobs', 'recent_job_count', @@ -115,10 +115,6 @@ class ContactList(JSONModel): contact_list_id=self.id, ) - @property - def created_at(self): - return utc_string_to_aware_gmt_datetime(self._dict['created_at']) - @property def contents(self): return self.download(self.service_id, self.id) diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 71a1916bf..0b64ae2fd 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -4285,7 +4285,7 @@ def test_redirects_to_template_if_job_exists_already( '123 phone numbers', ), )) -@freeze_time('2020-03-13 13:00') +@freeze_time('2020-06-13 13:00') def test_choose_from_contact_list( mocker, client_request, diff --git a/tests/app/main/views/uploads/test_upload_contact_list.py b/tests/app/main/views/uploads/test_upload_contact_list.py index 9f0b98ce1..96c0d3f37 100644 --- a/tests/app/main/views/uploads/test_upload_contact_list.py +++ b/tests/app/main/views/uploads/test_upload_contact_list.py @@ -458,7 +458,7 @@ def test_cant_save_bad_contact_list( (False, 'Not used yet.'), (True, 'Not used in the last 7 days.'), ]) -@freeze_time('2020-03-13 16:51:56') +@freeze_time('2020-06-13 16:51:56') def test_view_contact_list( mocker, client_request, diff --git a/tests/app/models/test_contact_list.py b/tests/app/models/test_contact_list.py index 9e6e32cd0..6877883b1 100644 --- a/tests/app/models/test_contact_list.py +++ b/tests/app/models/test_contact_list.py @@ -1,15 +1,7 @@ -from datetime import datetime - from app.models.contact_list import ContactList from app.models.job import PaginatedJobs -def test_created_at(): - created_at = ContactList({'created_at': '2016-05-06T07:08:09.061258'}).created_at - assert isinstance(created_at, datetime) - assert created_at.isoformat() == '2016-05-06T08:08:09.061258+01:00' - - def test_get_jobs(mock_get_jobs): contact_list = ContactList({'id': 'a', 'service_id': 'b'}) assert isinstance(contact_list.get_jobs(page=123), PaginatedJobs) diff --git a/tests/conftest.py b/tests/conftest.py index 64782fdd6..7b9cf9159 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1852,7 +1852,7 @@ def mock_create_contact_list(mocker, api_user_active): def mock_get_contact_lists(mocker, api_user_active, fake_uuid): def _get(service_id, template_type=None): return [{ - 'created_at': '2020-03-13 10:59:56', + 'created_at': '2020-06-13T09:59:56.000000Z', 'created_by': 'Test User', 'id': fake_uuid, 'original_file_name': 'EmergencyContactList.xls', @@ -1862,7 +1862,7 @@ def mock_get_contact_lists(mocker, api_user_active, fake_uuid): 'service_id': service_id, 'template_type': 'email', }, { - 'created_at': '2020-03-13 13:00:00', + 'created_at': '2020-06-13T12:00:00.000000Z', 'created_by': 'Test User', 'id': 'd7b0bd1a-d1c7-4621-be5c-3c1b4278a2ad', 'original_file_name': 'phone number list.csv', @@ -1872,7 +1872,7 @@ def mock_get_contact_lists(mocker, api_user_active, fake_uuid): 'service_id': service_id, 'template_type': 'sms', }, { - 'created_at': '2020-02-02 02:00:00', + 'created_at': '2020-05-02T01:00:00.000000Z', 'created_by': 'Test User', 'id': fake_uuid, 'original_file_name': 'UnusedList.tsv', @@ -1893,7 +1893,7 @@ def mock_get_contact_lists(mocker, api_user_active, fake_uuid): def mock_get_contact_list(mocker, api_user_active, fake_uuid): def _get(*, service_id, contact_list_id): return { - 'created_at': '2020-03-13 10:59:56', + 'created_at': '2020-06-13T09:59:56.000000Z', 'created_by': 'Test User', 'id': fake_uuid, 'original_file_name': 'EmergencyContactList.xls',