/
githubmirror
/
flask
Обзор
Документация
Войти
/
githubmirror
/
flask
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.0.x
tests/test_regression.py
24 строки
516 B
David Lord
remove test relying on Werkzeug Local internals
09 фев 2021, 05:04
Не верифицирован
09 фев 2021, 05:04
0ee1b0b
Код
Авторство
О чём код?
import flask def test_aborting(app): class Foo(Exception): whatever = 42 @app.errorhandler(Foo) def handle_foo(e): return str(e.whatever) @app.route("/") def index(): raise flask.abort(flask.redirect(flask.url_for("test"))) @app.route("/test") def test(): raise Foo() with app.test_client() as c: rv = c.get("/") assert rv.headers["Location"] == "http://localhost/test" rv = c.get("/test") assert rv.data == b"42"