mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Ensure one-off jobs do not appear on message log page
Upcoming changes to API will mean that by default its `get_notifications_for_service` DAO function will return one-off notifications. In most cases this is what we want, but the message log page should not show one-off notifications. By passing in the `include_one_off=False` option to API we can ensure that this page will stay the same when API changes.
This commit is contained in:
@@ -18,6 +18,7 @@ class NotificationApiClient(NotifyAdminAPIClient):
|
|||||||
include_from_test_key=None,
|
include_from_test_key=None,
|
||||||
format_for_csv=None,
|
format_for_csv=None,
|
||||||
to=None,
|
to=None,
|
||||||
|
include_one_off=None,
|
||||||
):
|
):
|
||||||
params = {}
|
params = {}
|
||||||
if page is not None:
|
if page is not None:
|
||||||
@@ -36,6 +37,8 @@ class NotificationApiClient(NotifyAdminAPIClient):
|
|||||||
params['format_for_csv'] = format_for_csv
|
params['format_for_csv'] = format_for_csv
|
||||||
if to is not None:
|
if to is not None:
|
||||||
params['to'] = to
|
params['to'] = to
|
||||||
|
if include_one_off is not None:
|
||||||
|
params['include_one_off'] = include_one_off
|
||||||
if job_id:
|
if job_id:
|
||||||
return self.get(
|
return self.get(
|
||||||
url='/service/{}/job/{}/notifications'.format(service_id, job_id),
|
url='/service/{}/job/{}/notifications'.format(service_id, job_id),
|
||||||
@@ -64,7 +67,12 @@ class NotificationApiClient(NotifyAdminAPIClient):
|
|||||||
return self.get(url='/service/{}/notifications/{}'.format(service_id, notification_id))
|
return self.get(url='/service/{}/notifications/{}'.format(service_id, notification_id))
|
||||||
|
|
||||||
def get_api_notifications_for_service(self, service_id):
|
def get_api_notifications_for_service(self, service_id):
|
||||||
ret = self.get_notifications_for_service(service_id, include_jobs=False, include_from_test_key=True)
|
ret = self.get_notifications_for_service(
|
||||||
|
service_id,
|
||||||
|
include_jobs=False,
|
||||||
|
include_from_test_key=True,
|
||||||
|
include_one_off=False
|
||||||
|
)
|
||||||
return self.map_letters_to_accepted(ret)
|
return self.map_letters_to_accepted(ret)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -1810,6 +1810,7 @@ def mock_get_notifications(
|
|||||||
include_jobs=None,
|
include_jobs=None,
|
||||||
include_from_test_key=None,
|
include_from_test_key=None,
|
||||||
to=None,
|
to=None,
|
||||||
|
include_one_off=None,
|
||||||
):
|
):
|
||||||
job = None
|
job = None
|
||||||
if job_id is not None:
|
if job_id is not None:
|
||||||
@@ -1858,6 +1859,7 @@ def mock_get_notifications_with_previous_next(mocker):
|
|||||||
include_jobs=None,
|
include_jobs=None,
|
||||||
include_from_test_key=None,
|
include_from_test_key=None,
|
||||||
to=None,
|
to=None,
|
||||||
|
include_one_off=None
|
||||||
):
|
):
|
||||||
return notification_json(service_id, with_links=True)
|
return notification_json(service_id, with_links=True)
|
||||||
|
|
||||||
@@ -1878,6 +1880,7 @@ def mock_get_notifications_with_no_notifications(mocker):
|
|||||||
include_jobs=None,
|
include_jobs=None,
|
||||||
include_from_test_key=None,
|
include_from_test_key=None,
|
||||||
to=None,
|
to=None,
|
||||||
|
include_one_off=None
|
||||||
):
|
):
|
||||||
return notification_json(service_id, rows=0)
|
return notification_json(service_id, rows=0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user