mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
Remove the use of schedule_for in post_notifications.
Years ago we started to implement a way to schedule a notification. We hit a problem but we never came up with a good solution and the feature never made it back to the top of the priority list. This PR removes the code for scheduled_for. There will be another PR to drop the scheduled_notifications table and remove the schedule_notifications service permission Unfortunately, I don't think we can remove the `scheduled_for` attribute from the notification.serialized method because out clients might fail if something is missing. For now I have left it in but defaulted the value to None.
This commit is contained in:
@@ -70,7 +70,7 @@ def test_get_notification_by_id_returns_200(
|
||||
"subject": None,
|
||||
'sent_at': sample_notification.sent_at,
|
||||
'completed_at': sample_notification.completed_at(),
|
||||
'scheduled_for': '2017-05-12T14:15:00.000000Z',
|
||||
'scheduled_for': None,
|
||||
'postage': None,
|
||||
}
|
||||
|
||||
@@ -166,26 +166,6 @@ def test_get_notification_by_id_returns_created_by_name_if_notification_created_
|
||||
assert json_response['created_by_name'] == 'Test User'
|
||||
|
||||
|
||||
def test_get_notifications_returns_scheduled_for(client, sample_template):
|
||||
sample_notification_with_reference = create_notification(template=sample_template,
|
||||
client_reference='some-client-reference',
|
||||
scheduled_for='2017-05-23 17:15')
|
||||
|
||||
auth_header = create_authorization_header(service_id=sample_notification_with_reference.service_id)
|
||||
response = client.get(
|
||||
path='/v2/notifications?reference={}'.format(sample_notification_with_reference.client_reference),
|
||||
headers=[('Content-Type', 'application/json'), auth_header])
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.headers['Content-type'] == 'application/json'
|
||||
|
||||
json_response = json.loads(response.get_data(as_text=True))
|
||||
assert len(json_response['notifications']) == 1
|
||||
|
||||
assert json_response['notifications'][0]['id'] == str(sample_notification_with_reference.id)
|
||||
assert json_response['notifications'][0]['scheduled_for'] == "2017-05-23T16:15:00.000000Z"
|
||||
|
||||
|
||||
def test_get_notification_by_reference_nonexistent_reference_returns_no_notifications(client, sample_service):
|
||||
auth_header = create_authorization_header(service_id=sample_service.id)
|
||||
response = client.get(
|
||||
|
||||
Reference in New Issue
Block a user