def test_news_message_to_json(self): msg = NewsMessage('to_addr', 'from_addr', '1348831860', [{ 'title': 'title1', 'description': 'description1', }, { 'picurl': 'picurl', 'url': 'url', }]) self.assertEqual( json.loads(msg.to_json()), { 'touser': '******', 'msgtype': 'news', 'news': { 'articles': [{ 'title': 'title1', 'description': 'description1' }, { 'picurl': 'picurl', 'url': 'url' }] } })
def test_news_message_to_json(self): msg = NewsMessage( 'to_addr', 'from_addr', '1348831860', [{ 'title': 'title1', 'description': 'description1', }, { 'picurl': 'picurl', 'url': 'url', }]) self.assertEqual( json.loads(msg.to_json()), { 'touser': '******', 'msgtype': 'news', 'news': { 'articles': [{ 'title': 'title1', 'description': 'description1' }, { 'picurl': 'picurl', 'url': 'url' }] } })