Skip to content
Myr

Adds 2 tests for Flask.run method

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Paulo Bu · committed by Paulo Bu · parent 80283d6 · Browse files · 1 file+28 added−0 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+28 added−0 removed

  • tests:+28 added−0 removed

1 file+28 added−0 removed

modified:tests/test_basic.py+28 added
20 unmodified lines
21from flask._compat import text_type22from werkzeug.exceptions import BadRequest, NotFound, Forbidden23from werkzeug.http import parse_date24from werkzeug.routing import BuildError25import werkzeug.serving262728def test_options_work():29 app = flask.Flask(__name__)
1476 unmodified lines
1506 rv = app.test_client().open('/')1507 assert rv.data == b'a'1508 rv = app.test_client().open('/b/')1509 assert rv.data == b'b'151015111512def test_run_defaults(monkeypatch):1513 rv = {}15141515 # Mocks werkzeug.serving.run_simple method1516 def run_simple_mock(*args, **kwargs):1517 rv['result'] = 'running...'15181519 app = flask.Flask(__name__)1520 monkeypatch.setattr(werkzeug.serving, 'run_simple', run_simple_mock)1521 app.run()1522 assert rv['result'] == 'running...'152315241525def test_run_server_port(monkeypatch):1526 rv = {}15271528 # Mocks werkzeug.serving.run_simple method1529 def run_simple_mock(hostname, port, application, *args, **kwargs):1530 rv['result'] = 'running on %s:%s ...' % (hostname, port)15311532 app = flask.Flask(__name__)1533 monkeypatch.setattr(werkzeug.serving, 'run_simple', run_simple_mock)1534 hostname, port = 'localhost', 80001535 app.run(hostname, port, debug=True)1536 assert rv['result'] == 'running on %s:%s ...' % (hostname, port)