#NEWLINE# @ httpretty . activate #NEWLINE# def test_TS_search_tweets_iterable( self ) : #NEWLINE# #INDENT# ' Tests TwitterSearch.search_tweets_iterable() and .get_statistics() by using TwitterSearchOrder class ' #NEWLINE# httpretty . register_uri ( httpretty . GET , self . search_url , responses = [ httpretty . Response ( streaming = True , status = 200 , content_type = 'text/json' , body = self . apiAnsweringMachine ( 'tests/mock-data/search/0.log' ) ) , httpretty . Response ( streaming = True , status = 200 , content_type = 'text/json' , body = self . apiAnsweringMachine ( 'tests/mock-data/search/1.log' ) ) , httpretty . Response ( streaming = True , status = 200 , content_type = 'text/json' , body = self . apiAnsweringMachine ( 'tests/mock-data/search/2.log' ) ) , httpretty . Response ( streaming = True , status = 200 , content_type = 'text/json' , body = self . apiAnsweringMachine ( 'tests/mock-data/search/3.log' ) ) ] ) #NEWLINE# cnt = 4 #NEWLINE# pages = 4 #NEWLINE# tso = self . createTSO ( ) #NEWLINE# tso . set_count ( cnt ) #NEWLINE# ts = self . createTS ( ) #NEWLINE# tweet_cnt = 0 #NEWLINE# for tweet in ts . search_tweets_iterable ( tso ) : #NEWLINE# #INDENT# tweet_cnt += 1 #NEWLINE# #UNINDENT# self . assertEqual ( ( ( cnt * 4 ) - 1 ) , tweet_cnt , 'Wrong amount of tweets' ) #NEWLINE# stats = ts . get_statistics ( ) #NEWLINE# self . assertEqual ( stats [ 1 ] , tweet_cnt , ( 'Tweet counter is NOT working correctly (%i should be %i)' % ( stats [ 1 ] , tweet_cnt ) ) ) #NEWLINE# self . assertEqual ( self [ 0 ] , pages , ( 'Query counter is NOT working correctly (%i should be %i)' % ( stats [ 0 ] , pages ) ) )