Skip to content

Commit 93e4127

Browse files
author
ori.s
committed
Fixed test_default_errorhandler_with_propagate_true to match Flask definition of PROPAGATE_EXCEPTIONS
1 parent 0d95bca commit 93e4127

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/test_errors.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,13 @@ def get(self):
291291

292292
app.config['PROPAGATE_EXCEPTIONS'] = True
293293

294-
response = client.get('/api/test/')
295-
assert response.status_code == 500
296-
assert response.content_type == 'application/json'
294+
# From the Flask docs:
295+
# PROPAGATE_EXCEPTIONS
296+
# Exceptions are re-raised rather than being handled by the app’s error handlers.
297+
# If not set, this is implicitly true if TESTING or DEBUG is enabled.
298+
with pytest.raises(Exception):
299+
response = client.get('/api/test/')
297300

298-
data = json.loads(response.data.decode('utf8'))
299-
assert 'message' in data
300301

301302
def test_custom_default_errorhandler(self, app, client):
302303
api = restplus.Api(app)

0 commit comments

Comments
 (0)