code: def test_redirect_keep_session(app, client, app_ctx):
      @app.route("/", methods=["GET", "POST"])
      def index():
          if flask.request.method == "POST":
              return flask.redirect("/getsession")
          flask.session["data"] = "foo"
          return "index"
  
      @app.route("/getsession")
      def get_session():
          return flask.session.get("data", "<missing>")
  
      with client:
          rv = client.get("/getsession")
          assert rv.data == b"<missing>"
  
          rv = client.get("/")
          assert rv.data == b"index"
          assert flask.session.get("data") == "foo"
  
          rv = client.post("/", data={}, follow_redirects=True)
          assert rv.data == b"foo"
          assert flask.session.get("data") == "foo"
  
          rv = client.get("/getsession")
          assert rv.data == b"foo"
  
imports: import importlib.metadata
  import click
  import pytest
  import flask
  from flask import appcontext_popped
  from flask.cli import ScriptInfo
  from flask.globals import _cv_request
  from flask.json import jsonify
  from flask.testing import EnvironBuilder
  from flask.testing import FlaskCliRunner
label_desc: Use image node_id 10 for calling a global function with example usage: test_redirect_keep_session(app, client, app_ctx) and returns: str, flask, flask