ensure tests have test_ prefix

also remove unused code branch

thanks, coverage!
This commit is contained in:
Leo Hemsted
2018-04-30 13:23:02 +01:00
parent 0efa223fb2
commit e35c1bde77
2 changed files with 2 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ register_errors(template_statistics)
@template_statistics.route('') @template_statistics.route('')
def get_template_statistics_for_service_by_day(service_id): def get_template_statistics_for_service_by_day(service_id):
try: try:
limit_days = int(request.args.get('limit_days')) limit_days = int(request.args.get('limit_days', ''))
except ValueError: except ValueError:
error = '{} is not an integer'.format(request.args.get('limit_days')) error = '{} is not an integer'.format(request.args.get('limit_days'))
message = {'limit_days': [error]} message = {'limit_days': [error]}
@@ -45,10 +45,6 @@ def get_template_statistics_for_service_by_day(service_id):
@template_statistics.route('/<template_id>') @template_statistics.route('/<template_id>')
def get_template_statistics_for_template_id(service_id, template_id): def get_template_statistics_for_template_id(service_id, template_id):
template = dao_get_template_by_id_and_service_id(template_id, service_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 data = None
notification = dao_get_last_template_usage(template_id, template.template_type) notification = dao_get_last_template_usage(template_id, template.template_type)

View File

@@ -37,7 +37,7 @@ def set_up_get_all_from_hash(mock_redis, side_effect):
{'limit_days': 3.5}, {'limit_days': 3.5},
{'limit_days': 'blurk'}, {'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( json_resp = admin_request.get(
'template_statistics.get_template_statistics_for_service_by_day', 'template_statistics.get_template_statistics_for_service_by_day',
service_id=uuid.uuid4(), service_id=uuid.uuid4(),