Example #1
0
    def testMicroBlogForwardsParser(self):

        test_url = 'http://weibo.com/aj/mblog/info/big?ajwvr=6&_t=0&from=singleWeiBo&id=4088805093057594&__rnd=1491471906078'
        parser = ForwardCommentLikeParser(opener=self.opener,
                                          url=test_url,
                                          bundle=self.bundle)
        urls, _ = self._get_urls_and_bundles(parser.parse())

        self.assertEqual(len(urls), 1)

        weibo = self.weibos_collection.find_one({
            'mid': '3596988739933218',
            'uid': self.test_uid
        })
        self.assertLessEqual(len(weibo['forwards']), 20)
        self.assertGreater(len(weibo['forwards']), 0)

        parser.parse(urls[0])
        weibo = self.weibos_collection.find_one({
            'mid': '3596988739933218',
            'uid': self.test_uid
        })
        self.assertLessEqual(len(weibo['forwards']), 40)
        self.assertGreater(len(weibo['forwards']), 10)
        self.assertNotEqual(weibo['forwards'][0], weibo['forwards'][10])
Example #2
0
 def testMicroBlogLikesParser(self):
     test_url = 'http://weibo.com/aj/like/big?mid=3599246068109415&_t=0&__rnd=1373634556882'
     parser = ForwardCommentLikeParser(opener=self.opener,
                                       url=test_url,
                                       bundle=self.bundle)
     urls, _ = self._get_urls_and_bundles(parser.parse())
     
     self.assertEqual(len(urls), 1)
     
     weibo = self.weibos_collection.find_one({'mid': '3599246068109415', 'uid': self.test_uid})
     self.assertEqual(len(weibo['likes']), 30)
Example #3
0
    def testMicroBlogLikesParser(self):
        test_url = 'http://weibo.com/aj/like/big?mid=3599246068109415&_t=0&__rnd=1373634556882'
        parser = ForwardCommentLikeParser(opener=self.opener,
                                          url=test_url,
                                          bundle=self.bundle)
        urls, _ = self._get_urls_and_bundles(parser.parse())

        self.assertEqual(len(urls), 1)

        weibo = self.weibos_collection.find_one({
            'mid': '3599246068109415',
            'uid': self.test_uid
        })
        self.assertEqual(len(weibo['likes']), 30)
Example #4
0
 def testMicroBlogForwardsParser(self):
     test_url = 'http://weibo.com/aj/mblog/info/big?id=3596988739933218&_t=0&__rnd=1373094212593'
     parser = ForwardCommentLikeParser(opener=self.opener,
                                       url=test_url,
                                       bundle=self.bundle)
     urls, _ = self._get_urls_and_bundles(parser.parse())
     
     self.assertEqual(len(urls), 1)
     
     weibo = self.weibos_collection.find_one({'mid': '3596988739933218', 'uid': self.test_uid})
     self.assertLessEqual(len(weibo['forwards']), 20)
     self.assertGreater(len(weibo['forwards']), 0)
     
     parser.parse(urls[0])
     weibo = self.weibos_collection.find_one({'mid': '3596988739933218', 'uid': self.test_uid})
     self.assertLessEqual(len(weibo['forwards']), 40)
     self.assertGreater(len(weibo['forwards']), 10)
     self.assertNotEqual(weibo['forwards'][0], 
                         weibo['forwards'][10])
Example #5
0
    def testMicroBlogForwardsParser(self):
        test_url = 'http://weibo.com/aj/mblog/info/big?id=3596988739933218&_t=0&__rnd=1373094212593'
        parser = ForwardCommentLikeParser(opener=self.opener,
                                          url=test_url,
                                          bundle=self.bundle)
        urls, _ = self._get_urls_and_bundles(parser.parse())

        self.assertEqual(len(urls), 1)

        weibo = self.weibos_collection.find_one({
            'mid': '3596988739933218',
            'uid': self.test_uid
        })
        self.assertLessEqual(len(weibo['forwards']), 20)
        self.assertGreater(len(weibo['forwards']), 0)

        parser.parse(urls[0])
        weibo = self.weibos_collection.find_one({
            'mid': '3596988739933218',
            'uid': self.test_uid
        })
        self.assertLessEqual(len(weibo['forwards']), 40)
        self.assertGreater(len(weibo['forwards']), 10)
        self.assertNotEqual(weibo['forwards'][0], weibo['forwards'][10])