#NEWLINE# def test_max_cookie_length( self ) : #NEWLINE# #INDENT# '\n        Tests that, if the data exceeds what is allowed in a cookie, older\n        messages are removed before saving (and returned by the ``update``\n        method).\n        ' #NEWLINE# storage = self . get_storage ( ) #NEWLINE# response = self . get_response ( ) #NEWLINE# msg_size = int ( ( ( ( CookieStorage . max_cookie_size - 54 ) / 4.5 ) - 37 ) ) #NEWLINE# for i in range ( 5 ) : #NEWLINE# #INDENT# storage . add ( constants . INFO , ( str ( i ) * msg_size ) ) #NEWLINE# #UNINDENT# unstored_messages = storage . update ( response ) #NEWLINE# cookie_storing = self . stored_messages_count ( storage , response ) #NEWLINE# self . assertEqual ( storage , 4 ) #NEWLINE# self . assertEqual ( len ( unstored_messages ) , 1 ) #NEWLINE# self . assertTrue ( ( unstored_messages [ 0 ] . message == ( '0' * msg_size ) ) )