Skip to content
Myr

Moved testcase for test client context binding to the TestToolsTestCase

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 8dbd71e · Browse files · 1 file+30 added−30 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+30 added−30 removed

  • tests:+30 added−30 removed

1 file+30 added−30 removed

modified:tests/flask_tests.py+30 added-30 removed
151 unmodified lines
152 pass153 else:154 assert 0, 'expected runtime error'155156 def test_test_client_context_binding(self):157 app = flask.Flask(__name__)158 @app.route('/')159 def index():160 flask.g.value = 42161 return 'Hello World!'156163 @app.route('/other')164 def other():165 1/0166167 with app.test_client() as c:168 resp = c.get('/')169 assert flask.g.value == 42170 assert resp.data == 'Hello World!'171 assert resp.status_code == 200172173 resp = c.get('/other')174 assert not hasattr(flask.g, 'value')175 assert 'Internal Server Error' in resp.data176 assert resp.status_code == 500177 flask.g.value = 23178179 try:180 flask.g.value181 except (AttributeError, RuntimeError):182 pass183 else:184 raise AssertionError('some kind of exception expected')185186157class BasicFunctionalityTestCase(FlaskTestCase):158159 def test_options_work(self):160 app = flask.Flask(__name__)
919 unmodified lines
1080 req = flask.request._get_current_object()1081 with c.session_transaction():1082 self.assert_(req is flask.request._get_current_object())10831084 def test_test_client_context_binding(self):1085 app = flask.Flask(__name__)1086 @app.route('/')1087 def index():1088 flask.g.value = 421089 return 'Hello World!'10901091 @app.route('/other')1092 def other():1093 1/010941095 with app.test_client() as c:1096 resp = c.get('/')1097 assert flask.g.value == 421098 assert resp.data == 'Hello World!'1099 assert resp.status_code == 20011001101 resp = c.get('/other')1102 assert not hasattr(flask.g, 'value')1103 assert 'Internal Server Error' in resp.data1104 assert resp.status_code == 5001105 flask.g.value = 2311061107 try:1108 flask.g.value1109 except (AttributeError, RuntimeError):1110 pass1111 else:1112 raise AssertionError('some kind of exception expected')111311141115class InstanceTestCase(FlaskTestCase):11161117 def test_explicit_instance_paths(self):1118 here = os.path.abspath(os.path.dirname(__file__))
1190 unmodified lines