Esempio n. 1
0
 def test_session_from_https_request(self):
     environ = sample_environ(HTTPS='HTTPS')
     request = Request.from_environ(environ,
                                    session_class='watson.http.sessions.Memory')
     assert request.is_secure()
     request.session['arbitrary'] = 'value'
     sessions.session_to_cookie(request, Response())
     cookie = request.cookies[sessions.COOKIE_KEY]
     assert cookie['httponly']
     assert cookie['secure']
Esempio n. 2
0
 def test_not_modified(self):
     request = messages.Request(
         environ={
             'watson.session.class': 'watson.http.sessions.Memory',
             'watson.session.options': {}
         }
     )
     response = messages.Response()
     assert not sessions.session_to_cookie(request, response)
Esempio n. 3
0
 def add_session_cookie(self, controller):
     session_to_cookie(controller.request, controller.response)
Esempio n. 4
0
 def test_session_to_cookie(self):
     request = messages.Request(environ={})
     response = messages.Response()
     assert not sessions.session_to_cookie(request, response)
Esempio n. 5
0
 def add_session_cookie(self, controller):
     session_to_cookie(controller.request, controller.response)