#NEWLINE# def test_buffer_fills_up( self ) : #NEWLINE# #INDENT# with patch ( 'six.moves.urllib.request.urlopen' , return_value = self . mock ) as urlopen : #NEWLINE# #INDENT# for i in range ( ( i . MAX_LENGTH - 1 ) ) : #NEWLINE# #INDENT# self . consumer . send ( 'events' , '"Event"' ) #NEWLINE# assert ( not self . mock . called ) #NEWLINE# #UNINDENT# self . consumer . send ( 'events' , '"Last Event"' ) #NEWLINE# assert ( urlopen . call_count == 1 ) #NEWLINE# ( ( request , ) , _ ) = urlopen . call_args #NEWLINE# assert ( request . get_full_url ( ) == 'https://api.mixpanel.com/track' ) #NEWLINE# assert ( qs ( request . data ) == qs ( 'ip=0&data=WyJFdmVudCIsIkV2ZW50IiwiRXZlbnQiLCJFdmVudCIsIkV2ZW50IiwiRXZlbnQiLCJFdmVudCIsIkV2ZW50IiwiRXZlbnQiLCJMYXN0IEV2ZW50Il0%3D&verbose=1' ) )