Add new report to show monthly notification stats for each service

This report will be used by the engagement team. There is a form to give
a start and end date for the report, and the form is then downloaded
as a CSV file when the form is submitted.
This commit is contained in:
Katie Smith
2019-07-22 13:09:03 +01:00
parent 1bd5ff1dfc
commit 9dc13f1d8e
8 changed files with 169 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import uuid
from datetime import date
from unittest.mock import patch
import pytest
@@ -6,6 +7,7 @@ import werkzeug
from app.models.service import Service
from app.notify_client import NotifyAdminAPIClient
from app.notify_client.notification_api_client import notification_api_client
from tests import service_json
from tests.conftest import api_user_active, platform_admin_user, set_config
@@ -102,3 +104,16 @@ def test_generate_headers_sets_request_id_if_in_request_context(app_):
}
assert headers['X-B3-TraceId'] == request_context.request.request_id
assert headers['X-B3-SpanId'] == request_context.request.span_id
def test_get_notification_status_by_service(mocker):
mock_get = mocker.patch.object(notification_api_client, 'get')
start_date = date(2019, 4, 1)
end_date = date(2019, 4, 30)
notification_api_client.get_notification_status_by_service(start_date, end_date)
mock_get.assert_called_once_with(
url='service/monthly-data-by-service',
params={'start_date': '2019-04-01', 'end_date': '2019-04-30'}
)