'If the data exceeds what is allowed in a cookie, older messages are
removed before saving (and returned by the ``update`` method).'

def test_max_cookie_length(self):

    storage = self.get_storage()
    response = self.get_response()
    msg_size = int((((CookieStorage.max_cookie_size - 54) / 4.5) - 37))
    for i in range(5):
        storage.add(constants.INFO, (str(i) * msg_size))
    unstored_messages = storage.update(response)
    cookie_storing = self.stored_messages_count(storage, response)
    self.assertEqual(cookie_storing, 4)
    self.assertEqual(len(unstored_messages), 1)
    self.assertEqual(unstored_messages[0].message, ('0' * msg_size))
