def test_insertTweetStreaming(self): global status bf = Buffer(10, 10, "myhost", 100, True) for i in range(0, 10): status["id"] = i status["user"]["id"] = i bf.insertTweetStreaming(status, 1) self.assertEqual(len(bf.localBuffer.tweetList.getList()), 10) self.assertEqual(len(bf.localBuffer.userList.getList()), 10) self.assertEqual(len(bf.localBuffer.tweetStreamingList.getList()), 10)
def test_insertTweetSearchTimerActive(self): global status bf = Buffer(10, 10, "myhost", 100, True) start = time.time() bf.startTimer() for i in range(0, 5): status["id"] = i status["user"]["id"] = i bf.insertTweetSearch(status, 1) end = time.time() diff = end - start time.sleep(10) self.assertEqual(len(bf.localBuffer.tweetList.getList()), 0) bf.stopTimer()