Home / Function/ test_session_using_session_settings() — flask Function Reference

test_session_using_session_settings() — flask Function Reference

Architecture documentation for the test_session_using_session_settings() function in test_basic.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  77efe180_2e38_9b9b_3aee_9880062c1f44["test_session_using_session_settings()"]
  85bc4fb5_d1d7_a135_020d_69e052c12c0f["test_basic.py"]
  77efe180_2e38_9b9b_3aee_9880062c1f44 -->|defined in| 85bc4fb5_d1d7_a135_020d_69e052c12c0f
  6ea1611d_2801_3cb5_a5b9_5b6403cc0537["index()"]
  77efe180_2e38_9b9b_3aee_9880062c1f44 -->|calls| 6ea1611d_2801_3cb5_a5b9_5b6403cc0537
  style 77efe180_2e38_9b9b_3aee_9880062c1f44 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_basic.py lines 291–331

def test_session_using_session_settings(app, client):
    app.config.update(
        SERVER_NAME="www.example.com:8080",
        APPLICATION_ROOT="/test",
        SESSION_COOKIE_DOMAIN=".example.com",
        SESSION_COOKIE_HTTPONLY=False,
        SESSION_COOKIE_SECURE=True,
        SESSION_COOKIE_PARTITIONED=True,
        SESSION_COOKIE_SAMESITE="Lax",
        SESSION_COOKIE_PATH="/",
    )

    @app.route("/")
    def index():
        flask.session["testing"] = 42
        return "Hello World"

    @app.route("/clear")
    def clear():
        flask.session.pop("testing", None)
        return "Goodbye World"

    rv = client.get("/", "http://www.example.com:8080/test/")
    cookie = rv.headers["set-cookie"].lower()
    # or condition for Werkzeug < 2.3
    assert "domain=example.com" in cookie or "domain=.example.com" in cookie
    assert "path=/" in cookie
    assert "secure" in cookie
    assert "httponly" not in cookie
    assert "samesite" in cookie
    assert "partitioned" in cookie

    rv = client.get("/clear", "http://www.example.com:8080/test/")
    cookie = rv.headers["set-cookie"].lower()
    assert "session=;" in cookie
    # or condition for Werkzeug < 2.3
    assert "domain=example.com" in cookie or "domain=.example.com" in cookie
    assert "path=/" in cookie
    assert "secure" in cookie
    assert "samesite" in cookie
    assert "partitioned" in cookie

Subdomains

Defined In

Calls

Frequently Asked Questions

What does test_session_using_session_settings() do?
test_session_using_session_settings() is a function in the flask codebase, defined in tests/test_basic.py.
Where is test_session_using_session_settings() defined?
test_session_using_session_settings() is defined in tests/test_basic.py at line 291.
What does test_session_using_session_settings() call?
test_session_using_session_settings() calls 1 function(s): index.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free