#NEWLINE# def test_batch_create_customer( self ) : #NEWLINE# #INDENT# batch_api_one = self . api . start_batch ( ) #NEWLINE# batch_api_two = self . api . start_batch ( ) #NEWLINE# data = { #NEWLINE# #INDENT# 'segment' : 'Batch Updated Customer' , #NEWLINE# #UNINDENT# } #NEWLINE# for x in range ( 10 ) : #NEWLINE# #INDENT# batch_api_one . customer_create ( ( 'test+python+%s@sendwithus.com' % x ) , data ) #NEWLINE# self . assertEqual ( batch_api_one . command_length ( ) , ( x + 1 ) ) #NEWLINE# if ( ( x % 2 ) == 0 ) : #NEWLINE# #INDENT# batch_api_two . customer_create ( ( 'test+python+%s+again@sendwithus.com' % x ) , data ) #NEWLINE# self . assertEqual ( batch_api_two . command_length ( ) , ( ( x / 2 ) + 1 ) ) #NEWLINE# #UNINDENT# #UNINDENT# result = batch_api_one . execute ( ) . json ( ) #NEWLINE# self . assertEqual ( len ( result ) , 10 ) #NEWLINE# for response in result : #NEWLINE# #INDENT# self . assertEqual ( response [ 'status_code' ] , 200 ) #NEWLINE# #UNINDENT# self . assertEqual ( batch_api_one . command_length ( ) , 0 ) #NEWLINE# self . assertEqual ( batch_api_two . command_length ( ) , 5 ) #NEWLINE# result = batch_api_two . execute ( ) . json ( ) #NEWLINE# self . assertEqual ( len ( result ) , 5 ) #NEWLINE# for response in result : #NEWLINE# #INDENT# self . assertEqual ( response [ 'status_code' ] , 200 ) #NEWLINE# #UNINDENT# self . assertEqual ( batch_api_one . command_length ( ) , 0 ) #NEWLINE# self . assertEqual ( batch_api_two . command_length ( ) , 0 )