Home / Function/ test_session_secret_key_fallbacks() — flask Function Reference

test_session_secret_key_fallbacks() — flask Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e0c502f9_4c6c_8a4d_8b94_d2133186b525["test_session_secret_key_fallbacks()"]
  85bc4fb5_d1d7_a135_020d_69e052c12c0f["test_basic.py"]
  e0c502f9_4c6c_8a4d_8b94_d2133186b525 -->|defined in| 85bc4fb5_d1d7_a135_020d_69e052c12c0f
  style e0c502f9_4c6c_8a4d_8b94_d2133186b525 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_basic.py lines 374–399

def test_session_secret_key_fallbacks(app, client) -> None:
    @app.post("/")
    def set_session() -> str:
        flask.session["a"] = 1
        return ""

    @app.get("/")
    def get_session() -> dict[str, t.Any]:
        return dict(flask.session)

    # Set session with initial secret key, and two valid expiring keys
    app.secret_key, app.config["SECRET_KEY_FALLBACKS"] = (
        "0 key",
        ["-1 key", "-2 key"],
    )
    client.post()
    assert client.get().json == {"a": 1}
    # Change secret key, session can't be loaded and appears empty
    app.secret_key = "? key"
    assert client.get().json == {}
    # Rotate the valid keys, session can be loaded
    app.secret_key, app.config["SECRET_KEY_FALLBACKS"] = (
        "+1 key",
        ["0 key", "-1 key"],
    )
    assert client.get().json == {"a": 1}

Subdomains

Defined In

Frequently Asked Questions

What does test_session_secret_key_fallbacks() do?
test_session_secret_key_fallbacks() is a function in the flask codebase, defined in tests/test_basic.py.
Where is test_session_secret_key_fallbacks() defined?
test_session_secret_key_fallbacks() is defined in tests/test_basic.py at line 374.

Analyze Your Own Codebase

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

Try Supermodel Free