Fix wrong permissions on dashboard pages

Anyone with access to a service should be able to see:
- monthly breakdown (non financial)
- incoming messages

Adds tests to check the same.
This commit is contained in:
Chris Hill-Scott
2017-07-07 15:58:40 +01:00
parent cfa63b450e
commit 037970c48c
3 changed files with 65 additions and 3 deletions

View File

@@ -1409,6 +1409,27 @@ def mock_get_monthly_template_statistics(mocker, service_one, fake_uuid):
)
@pytest.fixture(scope='function')
def mock_get_monthly_notification_stats(mocker, service_one, fake_uuid):
def _stats(service_id, year):
return {'data': {
datetime.utcnow().strftime('%Y-%m'): {
"email": {
"sending": 1,
"delivered": 1,
},
"sms": {
"sending": 1,
"delivered": 1,
},
}
}}
return mocker.patch(
'app.service_api_client.get_monthly_notification_stats',
side_effect=_stats
)
@pytest.fixture(scope='function')
def mock_get_template_statistics_for_template(mocker, service_one):
def _get_stats(service_id, template_id):