def test_subject_cookie(self): # the subject token is extracted from the cookie and # made available as part of the request. cookie = make_cookie() add_value(cookie, SUBJECT_COOKIE_NAME, 'mycookie', 60, True) env = {'HTTP_COOKIE': get_value(cookie)} request = Request(env) self.assertEqual(request.subject, 'mycookie')
def test_create_not_secure_cookie(self): logger = logging.getLogger('zoom.cookies') cookie = make_cookie() add_value(cookie, SESSION_COOKIE_NAME, 'mysession', 60, False) add_value(cookie, SUBJECT_COOKIE_NAME, 'mysubject', 60, False) logger.info(str(cookie)) cookie2 = Cookie.SimpleCookie() cookie2[SESSION_COOKIE_NAME] = 'mysession' cookie2[SESSION_COOKIE_NAME]['httponly'] = True cookie2[SESSION_COOKIE_NAME]['expires'] = 60 cookie2[SUBJECT_COOKIE_NAME] = 'mysubject' cookie2[SUBJECT_COOKIE_NAME]['httponly'] = True cookie2[SUBJECT_COOKIE_NAME]['expires'] = 60 logger.info(str(cookie2)) self.assertEqual(str(cookie), str(cookie2))