Beispiel #1
0
 def testMicroBlogForwardTimeParser(self):
     test_url = 'http://weibo.com/aj/mblog/info/big?_t=0&id=3600369441313426&__rnd=1373977781515'
     parser = ForwardCommentLikeParser(opener=self.opener,
                                       url=test_url,
                                       bundle=self.bundle)
     parser.parse()
     
     weibo = self.weibos_collection.find_one({'mid': '3600369441313426', 'uid': self.test_uid})
     self.assertGreater(len(weibo['forwards']), 0)
Beispiel #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, _ = 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)
Beispiel #3
0
    def testMicroBlogForwardTimeParser(self):
        test_url = 'http://weibo.com/aj/mblog/info/big?_t=0&id=3600369441313426&__rnd=1373977781515'
        parser = ForwardCommentLikeParser(opener=self.opener,
                                          url=test_url,
                                          bundle=self.bundle)
        parser.parse()

        weibo = self.weibos_collection.find_one({
            'mid': '3600369441313426',
            'uid': self.test_uid
        })
        self.assertGreater(len(weibo['forwards']), 0)
Beispiel #4
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, _ = 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)
Beispiel #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, _ = parser.parse()
     
     self.assertEqual(len(urls), 1)
     
     user = self.collection.find_one({'uid': self.test_uid})
     self.assertEqual(len(user['statuses'][0]['forwards']), 20)
     
     parser.parse(urls[0])
     user = self.collection.find_one({'uid': self.test_uid})
     self.assertEqual(len(user['statuses'][0]['forwards']), 40)
     self.assertNotEqual(user['statuses'][0]['forwards'][0], 
                         user['statuses'][0]['forwards'][20])
Beispiel #6
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, _ = 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']), 20)
        self.assertNotEqual(weibo['forwards'][0], weibo['forwards'][20])