Merge pull request #658 from alphagov/last-used-message

Last used message
This commit is contained in:
Leo Hemsted
2016-06-07 16:13:30 +01:00
5 changed files with 126 additions and 10 deletions

View File

@@ -995,7 +995,8 @@ def mock_get_template_statistics(mocker, service_one, fake_uuid):
},
"service": template['service'],
"id": str(generate_uuid()),
"day": "2016-04-04"
"day": "2016-04-04",
"updated_at": "2016-04-04T12:00:00.000000+00:00"
}
def _get_stats(service_id, limit_days=None):
@@ -1005,6 +1006,29 @@ def mock_get_template_statistics(mocker, service_one, fake_uuid):
'app.template_statistics_client.get_template_statistics_for_service', side_effect=_get_stats)
@pytest.fixture(scope='function')
def mock_get_template_statistics_for_template(mocker, service_one):
def _get_stats(service_id, template_id):
template = template_json(service_id, template_id, "Test template", "sms", "Something very interesting")
return [
{
"usage_count": 1,
"template": {
"name": template['name'],
"template_type": template['template_type'],
"id": template['id']
},
"service": template['service'],
"id": str(generate_uuid()),
"day": "2016-04-04",
"updated_at": "2016-04-04T12:00:00.000000+00:00"
}
]
return mocker.patch(
'app.template_statistics_client.get_template_statistics_for_service', side_effect=_get_stats)
@pytest.fixture(scope='function')
def mock_get_usage(mocker, service_one, fake_uuid):
def _get_usage(service_id):