diff --git a/app/dao/notifications_dao.py b/app/dao/notifications_dao.py index 3fc621dd7..6969874ad 100644 --- a/app/dao/notifications_dao.py +++ b/app/dao/notifications_dao.py @@ -261,8 +261,6 @@ def _filter_query(query, filter_dict=None): statuses = multidict.getlist('status') if statuses: - if statuses == ['pending']: - statuses = ['sending'] query = query.filter(Notification.status.in_(statuses)) # filter by template diff --git a/tests/app/celery/test_reporting_tasks.py b/tests/app/celery/test_reporting_tasks.py index 9e891327c..08d3ba92a 100644 --- a/tests/app/celery/test_reporting_tasks.py +++ b/tests/app/celery/test_reporting_tasks.py @@ -432,10 +432,10 @@ def test_create_nightly_notification_status_for_service_and_day(notify_db_sessio create_notification(template=second_template, status='failed') # team API key notifications are included - create_notification(template=second_template, status='pending', key_type=KEY_TYPE_TEAM) + create_notification(template=second_template, status='sending', key_type=KEY_TYPE_TEAM) # test notifications are ignored - create_notification(template=second_template, status='pending', key_type=KEY_TYPE_TEST) + create_notification(template=second_template, status='sending', key_type=KEY_TYPE_TEST) # historical notifications are included create_notification_history(template=second_template, status='delivered') @@ -479,7 +479,7 @@ def test_create_nightly_notification_status_for_service_and_day(notify_db_sessio assert email_failure_row.service_id == second_service.id assert email_failure_row.job_id == UUID('00000000-0000-0000-0000-000000000000') assert email_failure_row.notification_type == 'email' - assert email_failure_row.notification_status == 'pending' + assert email_failure_row.notification_status == 'sending' assert email_failure_row.notification_count == 1 assert email_failure_row.key_type == KEY_TYPE_TEAM diff --git a/tests/app/v2/notifications/test_get_notifications.py b/tests/app/v2/notifications/test_get_notifications.py index 5c9c3c5e6..ce8f8fa1a 100644 --- a/tests/app/v2/notifications/test_get_notifications.py +++ b/tests/app/v2/notifications/test_get_notifications.py @@ -347,25 +347,24 @@ def test_get_all_notifications_filter_by_template_type_invalid_template_type(cli def test_get_all_notifications_filter_by_single_status(client, sample_template): - # TODO had to change all the pendings to sendings. Is that correct? - notification = create_notification(template=sample_template, status="sending") + notification = create_notification(template=sample_template, status="pending") create_notification(template=sample_template) auth_header = create_service_authorization_header(service_id=notification.service_id) response = client.get( - path='/v2/notifications?status=sending', + path='/v2/notifications?status=pending', headers=[('Content-Type', 'application/json'), auth_header]) json_response = json.loads(response.get_data(as_text=True)) assert response.status_code == 200 assert response.headers['Content-type'] == "application/json" - assert json_response['links']['current'].endswith("/v2/notifications?status=sending") + assert json_response['links']['current'].endswith("/v2/notifications?status=pending") assert 'next' in json_response['links'].keys() assert len(json_response['notifications']) == 1 assert json_response['notifications'][0]['id'] == str(notification.id) - assert json_response['notifications'][0]['status'] == "sending" + assert json_response['notifications'][0]['status'] == "pending" def test_get_all_notifications_filter_by_status_invalid_status(client, sample_notification): @@ -414,11 +413,10 @@ def test_get_all_notifications_filter_by_multiple_statuses(client, sample_templa def test_get_all_notifications_filter_by_failed_status(client, sample_template): - # TODO had to change temporary-failure, permanent-failure, technical-failure to failed created_notification = create_notification(template=sample_template, status="created") failed_notifications = [ create_notification(template=sample_template, status=_status) - for _status in ["failed", "failed", "failed"] + for _status in ["failed"] ] auth_header = create_service_authorization_header(service_id=created_notification.service_id) @@ -432,7 +430,7 @@ def test_get_all_notifications_filter_by_failed_status(client, sample_template): assert response.headers['Content-type'] == "application/json" assert json_response['links']['current'].endswith("/v2/notifications?status=failed") assert 'next' in json_response['links'].keys() - assert len(json_response['notifications']) == 3 + assert len(json_response['notifications']) == 1 returned_notification_ids = [n['id'] for n in json_response['notifications']] for _id in [_notification.id for _notification in failed_notifications]: