MCPcopy Create free account
hub / github.com/pallets/flask / test_session_using_application_root

Function test_session_using_application_root

tests/test_basic.py:269–288  ·  view source on GitHub ↗
(app, client)

Source from the content-addressed store, hash-verified

267
268
269def test_session_using_application_root(app, client):
270 class PrefixPathMiddleware:
271 def __init__(self, app, prefix):
272 self.app = app
273 self.prefix = prefix
274
275 def __call__(self, environ, start_response):
276 environ["SCRIPT_NAME"] = self.prefix
277 return self.app(environ, start_response)
278
279 app.wsgi_app = PrefixPathMiddleware(app.wsgi_app, "/bar")
280 app.config.update(APPLICATION_ROOT="/bar")
281
282 @app.route("/")
283 def index():
284 flask.session["testing"] = 42
285 return "Hello World"
286
287 rv = client.get("/", "http://example.com:8080/")
288 assert "path=/bar" in rv.headers["set-cookie"].lower()
289
290
291def test_session_using_session_settings(app, client):

Callers

nothing calls this directly

Calls 2

getMethod · 0.45

Tested by

no test coverage detected