flask/tests/test_subclassing.py

34 lines
735 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
"""
2014-08-31 21:54:45 +02:00
tests.subclassing
2014-09-21 16:47:38 +02:00
~~~~~~~~~~~~~~~~~
Test that certain behavior of flask can be customized by
subclasses.
2015-01-02 11:35:00 +09:00
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
2014-09-03 21:02:03 +02:00
from flask._compat import StringIO
2014-09-03 20:50:54 +02:00
def test_suppressed_exception_logging():
class SuppressedFlask(flask.Flask):
def log_exception(self, exc_info):
pass
out = StringIO()
app = SuppressedFlask(__name__)
@app.route('/')
def index():
raise Exception('test')
2014-09-03 20:50:54 +02:00
rv = app.test_client().get('/', errors_stream=out)
2014-09-03 20:50:54 +02:00
assert rv.status_code == 500
assert b'Internal Server Error' in rv.data
assert not out.getvalue()