def get_comment_attachment(self, data): """ Return a dict with attachment data for Comment activity """ comment = data['attributes'] pretext = '%s commented on %s %s:' % ( MessageServiceBase.format_name(comment['created_by']), comment['item']['type'], self.format_item_link(comment['item'])) return { 'color': self.get_attachment_color(comment['item']), 'pretext': pretext, 'text': '"%s"' % MessageServiceBase.format_comment(comment['body']) }
def test_format_comment_trunc(): comment = 'a' * 51 assert MessageServiceBase.format_comment(comment)[-3:] == '...'
def test_format_comment(): comment = 'Hello' assert MessageServiceBase.format_comment(comment) == comment