Пример #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, [])