mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-23 17:39:13 -04:00
move status mapping logic to the api client
also added tests 👼
This commit is contained in:
@@ -66,3 +66,14 @@ class NotificationApiClient(NotifyAdminAPIClient):
|
||||
|
||||
def get_notification(self, service_id, notification_id):
|
||||
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)
|
||||
return self.map_letters_to_accepted(ret)
|
||||
|
||||
@staticmethod
|
||||
def map_letters_to_accepted(notifications):
|
||||
for notification in notifications['notifications']:
|
||||
if notification['notification_type'] == 'letter' and notification['status'] in ('created', 'sending'):
|
||||
notification['status'] = 'accepted'
|
||||
return notifications
|
||||
|
||||
Reference in New Issue
Block a user