Make DAO optionally return test key notifications

Developers need visibility of what their integration is doing within
the app. This includes notifications sent with a test key.

This commit adds an optional, defaults-to-false parameter to include
notifications sent from a test API key when getting notifications.
This commit is contained in:
Chris Hill-Scott
2016-09-23 10:27:10 +01:00
parent b36d0ff552
commit f9f3bb8370
2 changed files with 9 additions and 4 deletions

View File

@@ -236,7 +236,8 @@ def get_notifications_for_service(
limit_days=None,
key_type=None,
personalisation=False,
include_jobs=False
include_jobs=False,
include_from_test_key=False
):
if page_size is None:
page_size = current_app.config['PAGE_SIZE']
@@ -252,7 +253,7 @@ def get_notifications_for_service(
if key_type is not None:
filters.append(Notification.key_type == key_type)
else:
elif not include_from_test_key:
filters.append(Notification.key_type != KEY_TYPE_TEST)
query = Notification.query.filter(*filters)