Refresh dependencies and fix tests.

This commit is contained in:
Jake Moshenko 2017-04-04 23:28:49 -04:00
parent 3dd6e6919d
commit a0817bfd59
7 changed files with 102 additions and 82 deletions

View file

@ -1,8 +1,10 @@
import logging
import json
from flask import request, make_response, current_app
from werkzeug.exceptions import HTTPException
from app import analytics
from flask import request, abort as flask_abort, make_response, current_app
from auth.auth_context import get_authenticated_user, get_validated_token
logger = logging.getLogger(__name__)
@ -28,7 +30,11 @@ def _abort(status_code, data_object, headers):
resp = make_response(json.dumps(data_object), status_code, headers)
# Report the abort to the user.
flask_abort(resp)
# Raising HTTPException as workaround for https://github.com/pallets/werkzeug/issues/1098
new_exception = HTTPException(response=resp)
new_exception.code = status_code
raise new_exception
def exact_abort(status_code, message=None):
data = {}
@ -38,6 +44,7 @@ def exact_abort(status_code, message=None):
_abort(status_code, data, {})
def abort(status_code, message=None, issue=None, headers=None, **kwargs):
message = (str(message) % kwargs if message else