mirror of https://github.com/pallets/flask.git
parent
1636a4c410
commit
42fbbb4cbb
2
CHANGES
2
CHANGES
|
@ -17,6 +17,8 @@ Bugfix release, unreleased
|
|||
within the imported application module.
|
||||
- Fix encoding behavior of ``app.config.from_pyfile`` for Python 3. Fix
|
||||
``#2118``.
|
||||
- Use the``SERVER_NAME`` config if it is present as default values for
|
||||
``app.run``. ``#2109``, ``#2152``
|
||||
|
||||
Version 0.12
|
||||
------------
|
||||
|
|
|
@ -1681,3 +1681,20 @@ def test_run_server_port(monkeypatch):
|
|||
hostname, port = 'localhost', 8000
|
||||
app.run(hostname, port, debug=True)
|
||||
assert rv['result'] == 'running on %s:%s ...' % (hostname, port)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('host,port,expect_host,expect_port', (
|
||||
(None, None, 'pocoo.org', 8080),
|
||||
('localhost', None, 'localhost', 8080),
|
||||
(None, 80, 'pocoo.org', 80),
|
||||
('localhost', 80, 'localhost', 80),
|
||||
))
|
||||
def test_run_from_config(monkeypatch, host, port, expect_host, expect_port):
|
||||
def run_simple_mock(hostname, port, *args, **kwargs):
|
||||
assert hostname == expect_host
|
||||
assert port == expect_port
|
||||
|
||||
monkeypatch.setattr(werkzeug.serving, 'run_simple', run_simple_mock)
|
||||
app = flask.Flask(__name__)
|
||||
app.config['SERVER_NAME'] = 'pocoo.org:8080'
|
||||
app.run(host, port)
|
||||
|
|
Loading…
Reference in New Issue