MCPcopy Create free account
hub / github.com/pallets/quart / test_secure_cookie_session_interface_save_session

Function test_secure_cookie_session_interface_save_session

tests/test_sessions.py:42–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40
41
42async def test_secure_cookie_session_interface_save_session() -> None:
43 session = SecureCookieSession()
44 session["something"] = "else"
45 interface = SecureCookieSessionInterface()
46 app = Quart(__name__)
47 app.secret_key = "secret"
48 response = Response("")
49 await interface.save_session(app, session, response)
50 cookies: SimpleCookie = SimpleCookie()
51 cookies.load(response.headers["Set-Cookie"])
52 cookie = cookies[app.config["SESSION_COOKIE_NAME"]]
53 assert cookie["path"] == interface.get_cookie_path(app)
54 assert cookie["httponly"] == "" if not interface.get_cookie_httponly(app) else True
55 assert cookie["secure"] == "" if not interface.get_cookie_secure(app) else True
56 assert cookie["samesite"] == (interface.get_cookie_samesite(app) or "")
57 assert cookie["domain"] == (interface.get_cookie_domain(app) or "")
58 assert cookie["expires"] == (interface.get_expiration_time(app, session) or "")
59 assert response.headers["Vary"] == "Cookie"
60
61
62async def _save_session(session: SecureCookieSession) -> Response:

Callers

nothing calls this directly

Calls 11

save_sessionMethod · 0.95
QuartClass · 0.90
ResponseClass · 0.90
loadMethod · 0.80
get_cookie_pathMethod · 0.80
get_cookie_httponlyMethod · 0.80
get_cookie_secureMethod · 0.80
get_cookie_samesiteMethod · 0.80
get_cookie_domainMethod · 0.80
get_expiration_timeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…