Need to be able to query the notification statistics for the right number of days.

If the request is for the big numbers on the activity page, then we need to use the number right number of days.
Added an end point to get the data retention for the service and notification type, which is needed on the activity page to say how long the report is available for.
This commit is contained in:
Rebecca Law
2018-07-19 17:06:46 +01:00
parent dae29a1b61
commit 0675f09afb
5 changed files with 64 additions and 21 deletions

View File

@@ -35,6 +35,15 @@ def test_get_service_data_retention_returns_empty_list(client, sample_service):
assert len(json.loads(response.get_data(as_text=True))) == 0
def test_get_data_retention_for_service_notification_type(client, sample_service):
data_retention = create_service_data_retention(service_id=sample_service.id)
response = client.get('/service/{}/data-retention/notification-type/{}'.format(sample_service.id, 'sms'),
headers=[('Content-Type', 'application/json'), create_authorization_header()],
)
assert response.status_code == 200
assert json.loads(response.get_data(as_text=True)) == data_retention.serialize()
def test_get_service_data_retention_by_id(client, sample_service):
sms_data_retention = create_service_data_retention(service_id=sample_service.id)
create_service_data_retention(service_id=sample_service.id, notification_type='email',