forked from orbit-oss/flask
parent
1636a4c410
commit
42fbbb4cbb
2 changed files with 19 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue