Exemplo n.º 1
0
 def testTamperedCookie(self):
     mware = CnotesHandlerMiddleware()
     request = self._get_tampered_cookie_request()
     mware.process_request(request)
     self.assertEquals(request.cnotes, [])
     
     
Exemplo n.º 2
0
 def testGetAndClearCnotes(self):
     import cnotes
     mware = CnotesHandlerMiddleware()
     request = self._get_simple_cookie_request()
     mware.process_request(request)
     self.assertEquals(cnotes.get_and_clear(), [self.clear_text])
     self.assertEquals(cnotes.get_and_clear(), [])
Exemplo n.º 3
0
 def testAddCnote(self):
     import cnotes
     cnotes.add(self.clear_text)
     mware = CnotesHandlerMiddleware()
     request = self._get_no_cookie_request()
     orig_response = self._get_response()
     response = mware.process_response(request, orig_response)
     expected_key = self.key
     expected_value =  self.signed
     # FIXME: Add a cookie morsel as the compairson
     self.assertEquals(response.cookies['cnotes'].key, expected_key)
     self.assertEquals(response.cookies['cnotes'].value, expected_value)
Exemplo n.º 4
0
 def testRequestCnotes(self):
     mware = CnotesHandlerMiddleware()
     request = self._get_simple_cookie_request()
     mware.process_request(request)
     self.assertEquals(request.cnotes, [self.clear_text])
Exemplo n.º 5
0
 def testNoCookieRead(self):
     request = self._get_no_cookie_request()
     mware = CnotesHandlerMiddleware()
     mware.process_request(request)
     
     self.assertEquals(request.cnotes, [])