def _processTwitterResults(tweets): """Processes and filters tweets to determine if a text should be sent. """ tweet_filters = [ filters.filterSanitizeTweets, filters.filterOldTweets, filters.filterRetweets ] for tweet_filter in tweet_filters: tweets = tweet_filter(tweets) delayed_tweets = filters.filterKeepDelayedTweets(tweets) _writeOutData(tweets, delayed_tweets) message = _getNotification(tweets, delayed_tweets) should_notify = _shouldNotify(len(tweets), len(delayed_tweets)) return should_notify, message
def testFilterKeepDelayedTweets(self): tweets = [{'text': 'foo delay'}, {'text': 'bar'}] tweets = filters.filterKeepDelayedTweets(tweets) self.assertEqual(tweets, [{'text': 'foo delay'}])
def testFilterKeepDelayedTweets(self): tweets = [{'text' : 'foo delay'}, {'text' : 'bar'}] tweets = filters.filterKeepDelayedTweets(tweets) self.assertEqual(tweets, [{'text' : 'foo delay'}])