Skip to content
Myr

Add unittest for appcontext_tearing_down signal

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Davide Ceretti · committed by Davide Ceretti · parent b923712 · Browse files · 1 file+21 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+21 added−0 removed

  • tests:+21 added−0 removed

1 file+21 added−0 removed

modified:tests/test_signals.py+21 added
154 unmodified lines
155 assert message == 'This is a flash message'156 assert category == 'notice'157 finally:158 flask.message_flashed.disconnect(record, app)159160def test_appcontext_tearing_down_signal():161 app = flask.Flask(__name__)162 recorded = []163164 def record_teardown(sender, **kwargs):165 recorded.append(('tear_down', kwargs))166167 @app.route('/')168 def index():169 1 // 0170171 flask.appcontext_tearing_down.connect(record_teardown, app)172 try:173 with app.test_client() as c:174 rv = c.get('/')175 assert rv.status_code == 500176 assert recorded == []177 assert recorded == [('tear_down', {'exc': None})]178 finally:179 flask.appcontext_tearing_down.disconnect(record_teardown, app)