forked from orbit-oss/flask
parent
817903c9c1
commit
59f7966e31
3 changed files with 52 additions and 9 deletions
|
|
@ -15,6 +15,7 @@ import werkzeug
|
|||
|
||||
from flask._compat import text_type
|
||||
from flask.json import jsonify
|
||||
from flask.testing import make_test_environ_builder
|
||||
|
||||
|
||||
def test_environ_defaults_from_config(app, client):
|
||||
|
|
@ -74,6 +75,23 @@ def test_environ_base_modified(app, client, app_ctx):
|
|||
assert flask.g.user_agent == 'Bar'
|
||||
|
||||
|
||||
def test_client_open_environ(app, client, request):
|
||||
@app.route('/index')
|
||||
def index():
|
||||
return flask.request.remote_addr
|
||||
|
||||
builder = make_test_environ_builder(app, path='/index', method='GET')
|
||||
request.addfinalizer(builder.close)
|
||||
|
||||
rv = client.open(builder)
|
||||
assert rv.data == b'127.0.0.1'
|
||||
|
||||
environ = builder.get_environ()
|
||||
client.environ_base['REMOTE_ADDR'] = '127.0.0.2'
|
||||
rv = client.open(environ)
|
||||
assert rv.data == b'127.0.0.2'
|
||||
|
||||
|
||||
def test_specify_url_scheme(app, client):
|
||||
@app.route('/')
|
||||
def index():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue