Skip to content
Myr

Use app.testing=True for asserts in messages test.

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

authored by Ron DuPlain · committed by Ron DuPlain · parent 49b77fb · Browse files · 1 file+13 added−12 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+13 added−12 removed

  • other:+13 added−12 removed

1 file+13 added−12 removed

modified:flask/testsuite/basic.py+13 added-12 removed
307 unmodified lines
308 self.assert_(flask.session.modified)309 self.assert_equal(list(flask.get_flashed_messages()), ['Zap', 'Zip'])310311 def test_extended_flashing(self):312 # Be sure app.testing=True below, else tests can fail silently.313 #314 # Specifically, if app.testing is not set to True, the AssertionErrors315 # in the view functions will cause a 500 response to the test client316 # instead of propagating exceptions.317318 app = flask.Flask(__name__)319 app.secret_key = 'testkey'320 app.testing = True321322 @app.route('/')323 def index():324 flask.flash(u'Hello World')
41 unmodified lines
366 self.assert_equal(messages[0], u'Hello World')367 self.assert_equal(messages[1], flask.Markup(u'<em>Testing</em>'))368 return ''369363 # Note: if status code assertions are missing, failed tests still pass.364 #365 # Since app.test_client() does not set debug=True, the AssertionErrors366 # in the view functions are swallowed and the only indicator is a 500367 # status code.368 #369 # Also, create new test client on each test to clean flashed messages.370 # Create new test client on each test to clean flashed messages.371372 c = app.test_client()373 c.get('/')373 assert c.get('/test/').status_code == 200374 c.get('/test/')375376 c = app.test_client()377 c.get('/')377 assert c.get('/test_with_categories/').status_code == 200378 c.get('/test_with_categories/')379380 c = app.test_client()381 c.get('/')381 assert c.get('/test_filter/').status_code == 200382 c.get('/test_filter/')383384 c = app.test_client()385 c.get('/')385 assert c.get('/test_filters/').status_code == 200386 c.get('/test_filters/')387388 c = app.test_client()389 c.get('/')389 assert c.get('/test_filters_without_returning_categories/').status_code == 200390 c.get('/test_filters_without_returning_categories/')391392 def test_request_processing(self):393 app = flask.Flask(__name__)394 evts = []
726 unmodified lines