The test client and test_request_context are now both using the same logic internally for creating the environ. Also they use APPLICATION_ROOT now.
This commit is contained in:
parent
1ea3d4ea53
commit
e853a0f739
5 changed files with 38 additions and 29 deletions
|
|
@ -1042,6 +1042,21 @@ class BasicFunctionalityTestCase(FlaskTestCase):
|
|||
|
||||
class TestToolsTestCase(FlaskTestCase):
|
||||
|
||||
def test_environ_defaults_from_config(self):
|
||||
app = flask.Flask(__name__)
|
||||
app.testing = True
|
||||
app.config['SERVER_NAME'] = 'example.com:1234'
|
||||
app.config['APPLICATION_ROOT'] = '/foo'
|
||||
@app.route('/')
|
||||
def index():
|
||||
return flask.request.url
|
||||
|
||||
ctx = app.test_request_context()
|
||||
self.assertEqual(ctx.request.url, 'http://example.com:1234/foo/')
|
||||
with app.test_client() as c:
|
||||
rv = c.get('/')
|
||||
self.assertEqual(rv.data, 'http://example.com:1234/foo/')
|
||||
|
||||
def test_session_transactions(self):
|
||||
app = flask.Flask(__name__)
|
||||
app.testing = True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue