Skip to content
Myr

Merge pull request #2811 from greyli/test-routes-command-for-no-routes

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

Add test for routes command when no routes registered

authored by David Lord · committed by GitHub · parents 0b4296f, 4025e27 · Browse files · 1 file+16 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+16 added−0 removed

  • tests:+16 added−0 removed

1 file+16 added−0 removed

modified:tests/test_cli.py+16 added
391 unmodified lines
392393 cli = FlaskGroup(create_app=create_app)394 return partial(runner.invoke, cli)395396 @pytest.fixture397 def invoke_no_routes(self, runner):398 def create_app(info):399 app = Flask(__name__, static_folder=None)400 app.testing = True401402 return app403404 cli = FlaskGroup(create_app=create_app)405 return partial(runner.invoke, cli)406407 def expect_order(self, order, output):408 # skip the header and match the start of each row409 for expect, line in zip(order, output.splitlines()[2:]):410 # do this instead of startswith for nicer pytest output
29 unmodified lines
440 assert 'GET, HEAD, OPTIONS, POST' not in output441 output = invoke(['routes', '--all-methods']).output442 assert 'GET, HEAD, OPTIONS, POST' in output443444 def test_no_routes(self, invoke_no_routes):445 result = invoke_no_routes(['routes'])446 assert result.exit_code == 0447 assert 'No routes were registered.' in result.output448449450need_dotenv = pytest.mark.skipif(451 dotenv is None, reason='dotenv is not installed'452)453
104 unmodified lines