zoom.cookies module¶
zoom.cookies
The following test is a bit lame because the timestamp makes it tricky to test. Ideally we’d pass in a timer somehow but the cookie module is handling the time calculation so without diving into the innards of the http.cookies module this is what we have right now.
>>> cookie = SimpleCookie()
>>> add_value(cookie, 'name1', 'value1', 60, True)
>>> v = get_value(cookie)
>>> v.startswith('name1=value1; expires=')
True
>>> v.endswith('; Secure')
True
>>> len(v)
77
add a value to a cookie
extract cookies from raw cookie data
get the value portion of a cookie
Cookie handler
>>> request = zoom.utils.Bunch( ... cookies=None, ... session_timeout=1, ... site=zoom.sites.Site(), ... ) >>> response = handler(request, lambda a: zoom.response.Response()) >>> 'zoom_session=' in str(response.cookie) True
generate a new subject ID
construct a session cookie
>>> response = zoom.response.HTMLResponse('my page') >>> set_session_cookie(response, 'sessionid', 'subjectid', 60) >>> 'zoom_session=sessionid' in str(response.cookie) True >>> 'Secure' in str(response.cookie) True