def messages(self): """ Clears status message buffer and return pending current messages. """ # Get status message utility by adapter look-up status_message = IStatusMessage(self.request) # Fetch buffer return status_message.showStatusMessages()
def test_add(self): res = self.add_view() self.assertTrue(res is None) status = IStatusMessage(self.request) messages = status.showStatusMessages() message = messages[0] self.assertEqual(len(messages), 1) self.assertEqual(message.message, u'Added to favorite') response = self.request.response doc_url = self.document.absolute_url() self.assertEqual(response.status, 302) self.assertEqual(response.getHeader('location'), doc_url)