From e35c1bde778606128e83eddd07dba23cb1db08de Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Mon, 30 Apr 2018 13:23:02 +0100 Subject: [PATCH] ensure tests have test_ prefix also remove unused code branch thanks, coverage! --- app/template_statistics/rest.py | 6 +----- tests/app/template_statistics/test_rest.py | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/template_statistics/rest.py b/app/template_statistics/rest.py index b7d005d55..5c422998f 100644 --- a/app/template_statistics/rest.py +++ b/app/template_statistics/rest.py @@ -30,7 +30,7 @@ register_errors(template_statistics) @template_statistics.route('') def get_template_statistics_for_service_by_day(service_id): try: - limit_days = int(request.args.get('limit_days')) + limit_days = int(request.args.get('limit_days', '')) except ValueError: error = '{} is not an integer'.format(request.args.get('limit_days')) message = {'limit_days': [error]} @@ -45,10 +45,6 @@ def get_template_statistics_for_service_by_day(service_id): @template_statistics.route('/') def get_template_statistics_for_template_id(service_id, template_id): template = dao_get_template_by_id_and_service_id(template_id, service_id) - if not template: - message = 'No template found for id {}'.format(template_id) - errors = {'template_id': [message]} - raise InvalidRequest(errors, status_code=404) data = None notification = dao_get_last_template_usage(template_id, template.template_type) diff --git a/tests/app/template_statistics/test_rest.py b/tests/app/template_statistics/test_rest.py index 0f1a652a9..abf464773 100644 --- a/tests/app/template_statistics/test_rest.py +++ b/tests/app/template_statistics/test_rest.py @@ -37,7 +37,7 @@ def set_up_get_all_from_hash(mock_redis, side_effect): {'limit_days': 3.5}, {'limit_days': 'blurk'}, ]) -def get_template_statistics_for_service_by_day_with_bad_arg_returns_400(admin_request, query_string): +def test_get_template_statistics_for_service_by_day_with_bad_arg_returns_400(admin_request, query_string): json_resp = admin_request.get( 'template_statistics.get_template_statistics_for_service_by_day', service_id=uuid.uuid4(),