()
| 40 | |
| 41 | |
| 42 | async 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 | |
| 62 | async def _save_session(session: SecureCookieSession) -> Response: |
nothing calls this directly
no test coverage detected
searching dependent graphs…