mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 03:13:42 -05: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,
|
||||
format_for_csv=None,
|
||||
to=None,
|
||||
include_one_off=None,
|
||||
):
|
||||
params = {}
|
||||
if page is not None:
|
||||
@@ -36,6 +37,8 @@ class NotificationApiClient(NotifyAdminAPIClient):
|
||||
params['format_for_csv'] = format_for_csv
|
||||
if to is not None:
|
||||
params['to'] = to
|
||||
if include_one_off is not None:
|
||||
params['include_one_off'] = include_one_off
|
||||
if job_id:
|
||||
return self.get(
|
||||
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))
|
||||
|
||||
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)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -1810,6 +1810,7 @@ def mock_get_notifications(
|
||||
include_jobs=None,
|
||||
include_from_test_key=None,
|
||||
to=None,
|
||||
include_one_off=None,
|
||||
):
|
||||
job = None
|
||||
if job_id is not None:
|
||||
@@ -1858,6 +1859,7 @@ def mock_get_notifications_with_previous_next(mocker):
|
||||
include_jobs=None,
|
||||
include_from_test_key=None,
|
||||
to=None,
|
||||
include_one_off=None
|
||||
):
|
||||
return notification_json(service_id, with_links=True)
|
||||
|
||||
@@ -1878,6 +1880,7 @@ def mock_get_notifications_with_no_notifications(mocker):
|
||||
include_jobs=None,
|
||||
include_from_test_key=None,
|
||||
to=None,
|
||||
include_one_off=None
|
||||
):
|
||||
return notification_json(service_id, rows=0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user