示例#1
0
 def testTamperedCookie(self):
     mware = CnotesHandlerMiddleware()
     request = self._get_tampered_cookie_request()
     mware.process_request(request)
     self.assertEquals(request.cnotes, [])
     
     
示例#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(), [])
示例#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)
示例#4
0
 def testRequestCnotes(self):
     mware = CnotesHandlerMiddleware()
     request = self._get_simple_cookie_request()
     mware.process_request(request)
     self.assertEquals(request.cnotes, [self.clear_text])
示例#5
0
 def testNoCookieRead(self):
     request = self._get_no_cookie_request()
     mware = CnotesHandlerMiddleware()
     mware.process_request(request)
     
     self.assertEquals(request.cnotes, [])