Updated tests
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Armin Ronacher · committed by Armin Ronacher · parent e71a5ff · Browse files · 1 file·+13 added−33 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−33 removed
- tests:+13 added−33 removed
Provenance
- Commit
ba6bf23- Tree
edbd946- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
e71a5ff
1 file changed+13 added−33 removed
modified:tests/flask_tests.py+13 added-33 removed
396 unmodified lines397 rv = app.test_client().get('/').data398 assert 'after' in evts399 assert rv == 'request|after'400 401- def test_after_request_errors(self):402- app = flask.Flask(__name__)403- called = []404- @app.after_request405- def after_request(response):406- called.append(True)407- return response408- @app.route('/')409- def fails():410- 1/0411- rv = app.test_client().get('/')412- assert rv.status_code == 500413- assert 'Internal Server Error' in rv.data414- assert len(called) == 1415-416- def test_after_request_handler_error(self):417- called = []418- app = flask.Flask(__name__)419- @app.after_request420- def after_request(response):421- called.append(True)422- 1/0423- return response424- @app.route('/')425- def fails():426- 1/0427- rv = app.test_client().get('/')428- assert rv.status_code == 500429- assert 'Internal Server Error' in rv.data430- assert len(called) == 1431-401 def test_teardown_request_handler(self):402 called = []403 app = flask.Flask(__name__)404 @app.teardown_request23 unmodified lines428 assert rv.status_code == 200429 assert 'Response' in rv.data430 assert len(called) == 1431 463-432 def test_teardown_request_handler_error(self):433 called = []434 app = flask.Flask(__name__)435 @app.teardown_request25 unmodified lines461 assert rv.status_code == 500462 assert 'Internal Server Error' in rv.data463 assert len(called) == 2464 497-465 def test_before_after_request_order(self):466 called = []467 app = flask.Flask(__name__)468 @app.before_request44 unmodified lines513 rv = c.get('/error')514 assert rv.status_code == 500515 assert 'internal server error' == rv.data516 517+ def test_teardown_on_pop(self):518+ buffer = []519+ app = flask.Flask(__name__)520+ @app.teardown_request521+ def end_of_request(exception):522+ buffer.append(exception)523+524+ ctx = app.test_request_context()525+ ctx.push()526+ assert buffer == []527+ ctx.pop()528+ assert buffer == [None]529+530 def test_response_creation(self):531 app = flask.Flask(__name__)532 @app.route('/unicode')533 def from_unicode():1068 unmodified lines