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