Add monthly breakdown of usage

Basically:
- shows all the months from start of given financial year to now or end
  of given financial year (whichever is earliest)
- shows a breakdown of free and paid text messages for each of these
  months

Depends on:
- [x] https://github.com/alphagov/notifications-api/pull/699
This commit is contained in:
Chris Hill-Scott
2016-09-29 18:44:10 +01:00
parent 0a0bfa9232
commit b760457ba9
7 changed files with 233 additions and 8 deletions

View File

@@ -1172,14 +1172,26 @@ def mock_get_template_statistics_for_template(mocker, service_one):
def mock_get_usage(mocker, service_one, fake_uuid):
def _get_usage(service_id):
return {'data': {
"sms_count": 123,
"email_count": 456
"sms_count": 456123,
"email_count": 123
}}
return mocker.patch(
'app.service_api_client.get_service_usage', side_effect=_get_usage)
@pytest.fixture(scope='function')
def mock_get_billable_units(mocker):
def _get_usage(service_id, year):
return {
"April": 123,
"March": 456123
}
return mocker.patch(
'app.service_api_client.get_billable_units', side_effect=_get_usage)
@pytest.fixture(scope='function')
def mock_events(mocker):
def _create_event(event_type, event_data):