Add template type to response and refactor

This commit is contained in:
Imdad Ahad
2017-02-20 11:29:15 +00:00
parent 520c588d56
commit 36d52c6e42
4 changed files with 10 additions and 5 deletions

View File

@@ -57,6 +57,7 @@ from tests.app.conftest import (
def test_should_have_decorated_services_dao_functions():
assert dao_fetch_monthly_historical_stats_by_template_for_service.__wrapped__.__name__ == 'dao_fetch_monthly_historical_stats_by_template_for_service' # noqa
assert dao_fetch_monthly_historical_stats_for_service.__wrapped__.__name__ == 'dao_fetch_monthly_historical_stats_for_service' # noqa
assert dao_fetch_todays_stats_for_service.__wrapped__.__name__ == 'dao_fetch_todays_stats_for_service' # noqa
assert dao_fetch_stats_for_service.__wrapped__.__name__ == 'dao_fetch_stats_for_service' # noqa

View File

@@ -1477,6 +1477,8 @@ def test_get_template_stats_by_month_returns_correct_data(notify_db, notify_db_s
resp_json = json.loads(resp.get_data(as_text=True)).get('data')
assert resp.status_code == 200
assert resp_json["2016-05"][str(sample_template.id)]["name"] == "Template Name"
assert resp_json["2016-05"][str(sample_template.id)]["type"] == "sms"
assert resp_json["2016-05"][str(sample_template.id)]["counts"]["sending"] == 2
assert resp_json["2016-05"][str(sample_template.id)]["counts"]["temporary-failure"] == 1
assert resp_json["2016-05"][str(sample_template.id)]["counts"]["permanent-failure"] == 1