test_trap_bad_request_key_error() — flask Function Reference
Architecture documentation for the test_trap_bad_request_key_error() function in test_basic.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD be3e1359_6850_99c2_e05e_ef1e400c7842["test_trap_bad_request_key_error()"] 85bc4fb5_d1d7_a135_020d_69e052c12c0f["test_basic.py"] be3e1359_6850_99c2_e05e_ef1e400c7842 -->|defined in| 85bc4fb5_d1d7_a135_020d_69e052c12c0f style be3e1359_6850_99c2_e05e_ef1e400c7842 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_basic.py lines 1036–1064
def test_trap_bad_request_key_error(app, client, debug, trap, expect_key, expect_abort):
app.config["DEBUG"] = debug
app.config["TRAP_BAD_REQUEST_ERRORS"] = trap
@app.route("/key")
def fail():
flask.request.form["missing_key"]
@app.route("/abort")
def allow_abort():
flask.abort(400)
if expect_key:
rv = client.get("/key")
assert rv.status_code == 400
assert b"missing_key" not in rv.data
else:
with pytest.raises(KeyError) as exc_info:
client.get("/key")
assert exc_info.errisinstance(BadRequest)
assert "missing_key" in exc_info.value.get_description()
if expect_abort:
rv = client.get("/abort")
assert rv.status_code == 400
else:
with pytest.raises(BadRequest):
client.get("/abort")
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_trap_bad_request_key_error() do?
test_trap_bad_request_key_error() is a function in the flask codebase, defined in tests/test_basic.py.
Where is test_trap_bad_request_key_error() defined?
test_trap_bad_request_key_error() is defined in tests/test_basic.py at line 1036.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free