Skip to content

Commit

Permalink
Fix test_error_handler_registration for Werkzeug 0.14
Browse files Browse the repository at this point in the history
Since Werkzeug 0.14, the body of 412 responses if not sent
pallets/werkzeug#1231
  • Loading branch information
lafrech committed Jan 4, 2018
1 parent 20f225d commit 6273829
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/test_error_handler.py
Expand Up @@ -34,18 +34,21 @@ def test_error_handler_registration(self, code):
app = Flask('test')
client = app.test_client()

@app.route('/{}'.format(code))
@app.route('/')
def test():
abort(code)

Api(app)

with NoLoggingContext(app):
response = client.get('/{}'.format(code))
response = client.get('/')
assert response.status_code == code

data = json.loads(response.get_data(as_text=True))
assert data['status'] == str(default_exceptions[code]())
# Since Werkzeug 0.14, the body of 412 responses if not sent
# https://github.com/pallets/werkzeug/issues/1231
if code != 412:
data = json.loads(response.get_data(as_text=True))
assert data['status'] == str(default_exceptions[code]())

def test_error_handler_payload(self):

Expand Down

0 comments on commit 6273829

Please sign in to comment.