MCPcopy
hub / github.com/pallets/flask / test_context_binding

Function test_context_binding

tests/test_reqctx.py:107–120  ·  view source on GitHub ↗
(app)

Source from the content-addressed store, hash-verified

105
106
107def test_context_binding(app):
108 @app.route("/")
109 def index():
110 return f"Hello {flask.request.args['name']}!"
111
112 @app.route("/meh")
113 def meh():
114 return flask.request.url
115
116 with app.test_request_context("/?name=World"):
117 assert index() == "Hello World!"
118 with app.test_request_context("/meh"):
119 assert meh() == "http://localhost/meh"
120 assert not flask.request
121
122
123def test_context_test(app):

Callers

nothing calls this directly

Calls 3

mehFunction · 0.85
test_request_contextMethod · 0.80
indexFunction · 0.70

Tested by

no test coverage detected