Esempio n. 1
0
 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'])
     }
Esempio n. 2
0
 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'])
     }
Esempio n. 3
0
def test_format_comment_trunc():
    comment = 'a' * 51
    assert MessageServiceBase.format_comment(comment)[-3:] == '...'
Esempio n. 4
0
def test_format_comment():
    comment = 'Hello'
    assert MessageServiceBase.format_comment(comment) == comment