def test_sendData(self):
     userList = generateOneUser(userId = 1)
     tweetList = generateManyTweets(randomInteger(100), userId = 1)
     tweetStreamingList = ObjectList()
     tweetSearchList = ObjectList()
     for tweet in tweetList.getList():
         tweetStreaming = TweetStreaming(randomTweetStreaming(tweet.id, 1))
         tweetStreamingList.append(tweetStreaming)
         tweetSearch = TweetSearch(randomTweetSearch(tweet.id, 1))
         tweetSearchList.append(tweetSearch)
     self.wsDb.sendData(tweetList, userList, tweetStreamingList, tweetSearchList)
Example #2
0
def createData(base):
    status = getOneStatusTS()
    randomTweets = base + randomInteger(99) + 1
    tweetList = ObjectList()
    userList = ObjectList()
    streamingList = ObjectList()
    searchList = ObjectList()
    for i in range(base, randomTweets):
        status["id"] = i
        status["user"]["id"] = i
        ps = ParserStatus(status)
        tweet = Tweet(ps.getTweet())
        user = User(ps.getUser())
        tweetList.append(tweet)
        userList.append(user)
        streamingList.append(TweetStreaming(randomTweetStreaming(i, 1)))
        searchList.append(TweetSearch(randomTweetSearch(i, 1)))
    return tweetList, userList, streamingList, searchList
def generateManyTweetStreamings(randomTweetStreamings, tweetId, streamingId):
    tweetStreamingList = ObjectList()
    for i in range(0, randomTweetStreamings):
        tweetStreaming = TweetStreaming(randomTweetStreaming(tweetId, streamingId))
        tweetStreamingList.append(tweetStreaming)
    return tweetStreamingList
def generateOneTweetStreaming(tweetId, streamingId):
    tweetStreaming = TweetStreaming(randomTweetStreaming(tweetId, streamingId))
    tweetStreamingList = ObjectList()
    tweetStreamingList.append(tweetStreaming)
    return tweetStreamingList
 def test_addRepeatedTweetStreaming(self):
     lb = LocalBuffer()
     lb.addTweetStreaming(TweetStreaming(randomTweetStreaming(1, 1)))
     self.assertRaises(Exception, lb.addTweetStreaming, [TweetStreaming(randomTweetStreaming(1, 1)),])
 def test_addTweetStreaming(self):
     lb = LocalBuffer()
     lb.addTweetStreaming(TweetStreaming(randomTweetStreaming(1, 1)))
     self.assertEqual(len(lb.tweetStreamingList.getList()), 1)