mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-18 13:38:53 -04:00
Corrected error message format
This commit is contained in:
@@ -24,9 +24,9 @@ def get_template_statistics_for_service(service_id):
|
|||||||
try:
|
try:
|
||||||
limit_days = int(request.args['limit_days'])
|
limit_days = int(request.args['limit_days'])
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
error = 'Limit days {} is not an integer'.format(request.args['limit_days'])
|
error = '{} is not an integer'.format(request.args['limit_days'])
|
||||||
current_app.logger.error(error)
|
current_app.logger.error(error)
|
||||||
return jsonify(result="error", message=[error]), 400
|
return jsonify(result="error", message={'limit_days': [error]}), 400
|
||||||
else:
|
else:
|
||||||
limit_days = None
|
limit_days = None
|
||||||
stats = dao_get_template_statistics_for_service(service_id, limit_days=limit_days)
|
stats = dao_get_template_statistics_for_service(service_id, limit_days=limit_days)
|
||||||
|
|||||||
@@ -133,4 +133,4 @@ def test_get_all_template_statistics_with_bad_limit_arg_returns_400(notify_api,
|
|||||||
assert response.status_code == 400
|
assert response.status_code == 400
|
||||||
json_resp = json.loads(response.get_data(as_text=True))
|
json_resp = json.loads(response.get_data(as_text=True))
|
||||||
assert json_resp['result'] == 'error'
|
assert json_resp['result'] == 'error'
|
||||||
assert json_resp['message'] == ['Limit days blurk is not an integer']
|
assert json_resp['message'] == {'limit_days': ['blurk is not an integer']}
|
||||||
|
|||||||
Reference in New Issue
Block a user