Exemplo n.º 1
0
 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'
                 }]
             }
         })
Exemplo n.º 2
0
 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'
                 }]
             }
         })