#NEWLINE# def test_broadcast_routing_with_two_erroring( self ) : #NEWLINE# #INDENT# method = 'our_fake_method' #NEWLINE# method_kwargs = dict ( arg1 = 1 , arg2 = 2 ) #NEWLINE# direction = 'down' #NEWLINE# def our_fake_method_failing( message , **kwargs ) : #NEWLINE# #INDENT# raise test . TestingException ( 'fake failure' ) #NEWLINE# #UNINDENT# def our_fake_method( message , **kwargs ) : #NEWLINE# #INDENT# return ( 'response-%s' % message . routing_path ) #NEWLINE# #UNINDENT# fakes . stub_bcast_methods ( self , 'our_fake_method' , our_fake_method ) #NEWLINE# fakes . stub_bcast_method ( self , 'child-cell2' , 'our_fake_method' , our_fake_method_failing ) #NEWLINE# fakes . stub_bcast_method ( self , 'grandchild-cell3' , 'our_fake_method' , our_fake_method_failing ) #NEWLINE# bcast_message = messaging . _BroadcastMessage ( self . msg_runner , self . ctxt , method , method_kwargs , direction , run_locally = True , need_response = True ) #NEWLINE# responses = bcast_message . process ( ) #NEWLINE# self . assertEqual ( 8 , len ( responses ) ) #NEWLINE# failure_responses = [ resp for resp in responses if resp . failure ] #NEWLINE# success_responses = [ resp for resp in responses if ( not resp . failure ) ] #NEWLINE# self . assertEqual ( 2 , len ( failure_responses ) ) #NEWLINE# self . assertEqual ( 6 , len ( success_responses ) ) #NEWLINE# for response in success_responses : #NEWLINE# #INDENT# self . assertFalse ( response . failure ) #NEWLINE# self . assertEqual ( ( 'response-%s' % response . cell_name ) , response . value_or_raise ( ) ) #NEWLINE# #UNINDENT# for response in failure_responses : #NEWLINE# #INDENT# self . assertIn ( response . cell_name , [ 'api-cell!child-cell2' , 'api-cell!child-cell3!grandchild-cell3' ] ) #NEWLINE# self . assertTrue ( response . failure ) #NEWLINE# self . assertRaises ( test . TestingException , response . value_or_raise )