def test_single_mention(self):
     msg_string = "hi @world!"
     result = message_contents(msg_string)
     self.assertEquals(result, '{"mentions": ["world"]}')
 def test_links(self):
     with HTTMock(nbc_olympics_mock):
         msg_string = "Olympics are starting soon; http://www.nbcolympics.com"
         result = message_contents(msg_string)
         self.assertEquals(result, '{"links": [{"url": "http://www.nbcolympics.com", "title": "NBC Olympics | Home of the 2016 Olympic Games in Rio"}]}')
 def test_links_bad_response(self):
     with HTTMock(error):
         msg_string = "Do not append title if you cannot reach page http://www.500error.com"
         result = message_contents(msg_string)
         self.assertEquals(result, '{"links": [{"url": "http://www.500error.com", "title": ""}]}')
 def test_empty_parenthesis(self):
     msg_string = "()"
     result = message_contents(msg_string)
     self.assertEquals(result, '{}')
 def test_sixteen_character_emoticon(self):
     msg_string="1234567890123456"
     result = message_contents(msg_string)
     self.assertEquals(result, '{}')
 def test_custom_emoticons(self):
     msg_string = "(unittest) (ftw)"
     result = message_contents(msg_string)
     self.assertEquals(result, '{"emoticons": ["unittest", "ftw"]}')
 def test_remove_duplicate_mentions(self):
     msg_string = "@twice @twice"
     result = message_contents(msg_string)
     self.assertEquals(result, '{"mentions": ["twice"]}')
 def test_multiple_mentions(self):
     msg_string = "@hello @world"
     result = message_contents(msg_string)
     self.assertEquals(result, '{"mentions": ["world", "hello"]}')