MCPcopy Create free account
hub / github.com/pallets/quart / test_blueprint_error_handler

Function test_blueprint_error_handler

tests/test_blueprints.py:108–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106
107
108async def test_blueprint_error_handler() -> None:
109 app = Quart(__name__)
110 blueprint = Blueprint("blueprint", __name__)
111
112 @blueprint.route("/error/")
113 async def error() -> ResponseReturnValue:
114 abort(409)
115 return "OK"
116
117 @blueprint.errorhandler(409)
118 async def handler(_: Exception) -> ResponseReturnValue:
119 return "Something Unique", 409
120
121 app.register_blueprint(blueprint)
122
123 response = await app.test_client().get("/error/")
124 assert response.status_code == 409
125 assert b"Something Unique" in (await response.get_data())
126
127
128async def test_blueprint_method_view() -> None:

Callers

nothing calls this directly

Calls 5

test_clientMethod · 0.95
QuartClass · 0.90
BlueprintClass · 0.90
getMethod · 0.45
get_dataMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…