Skip to content
Myr

relax routes cli match order

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

authored by David Lord · committed by David Lord · parent 12d3f4f · Browse files · 1 file+16 added−17 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−17 removed

  • tests:+16 added−17 removed

1 file+16 added−17 removed

modified:tests/test_cli.py+16 added-17 removed
420 unmodified lines
421422423class TestRoutes:424 @pytest.fixture425 def invoke(self, runner):426 def create_app():427 app = Flask(__name__)428 app.testing = True425 def app(self):426 app = Flask(__name__)427 app.testing = True428430 @app.route("/get_post/<int:x>/<int:y>", methods=["GET", "POST"])431 def yyy_get_post(x, y):432 pass429 @app.route("/get_post/<int:x>/<int:y>", methods=["GET", "POST"])430 def yyy_get_post(x, y):431 pass432434 @app.route("/zzz_post", methods=["POST"])435 def aaa_post():436 pass433 @app.route("/zzz_post", methods=["POST"])434 def aaa_post():435 pass436438 return app437 return app438439 @pytest.fixture440 def invoke(self, app, runner):440 cli = FlaskGroup(create_app=create_app)441 cli = FlaskGroup(create_app=lambda: app)442 return partial(runner.invoke, cli)443444 @pytest.fixture445 def invoke_no_routes(self, runner):
16 unmodified lines
462 result = invoke(["routes"])463 assert result.exit_code == 0464 self.expect_order(["aaa_post", "static", "yyy_get_post"], result.output)465465 def test_sort(self, invoke):466 def test_sort(self, app, invoke):467 default_output = invoke(["routes"]).output468 endpoint_output = invoke(["routes", "-s", "endpoint"]).output469 assert default_output == endpoint_output470 self.expect_order(
3 unmodified lines
474 self.expect_order(475 ["yyy_get_post", "static", "aaa_post"],476 invoke(["routes", "-s", "rule"]).output,477 )477 self.expect_order(478 ["aaa_post", "yyy_get_post", "static"],479 invoke(["routes", "-s", "match"]).output,480 )478 match_order = [r.endpoint for r in app.url_map.iter_rules()]479 self.expect_order(match_order, invoke(["routes", "-s", "match"]).output)480481 def test_all_methods(self, invoke):482 output = invoke(["routes"]).output483 assert "GET, HEAD, OPTIONS, POST" not in output
186 unmodified lines