| 372 | |
| 373 | |
| 374 | def test_session_secret_key_fallbacks(app, client) -> None: |
| 375 | @app.post("/") |
| 376 | def set_session() -> str: |
| 377 | flask.session["a"] = 1 |
| 378 | return "" |
| 379 | |
| 380 | @app.get("/") |
| 381 | def get_session() -> dict[str, t.Any]: |
| 382 | return dict(flask.session) |
| 383 | |
| 384 | # Set session with initial secret key |
| 385 | client.post() |
| 386 | assert client.get().json == {"a": 1} |
| 387 | # Change secret key, session can't be loaded and appears empty |
| 388 | app.secret_key = "new test key" |
| 389 | assert client.get().json == {} |
| 390 | # Add initial secret key as fallback, session can be loaded |
| 391 | app.config["SECRET_KEY_FALLBACKS"] = ["test key"] |
| 392 | assert client.get().json == {"a": 1} |
| 393 | |
| 394 | |
| 395 | def test_session_expiration(app, client): |