#NEWLINE# @ mock . patch ( 'nailgun.task.task.rpc.cast' ) #NEWLINE# def test_node_group_deletion_failed_while_previous_in_progress( self , mocked_rpc ) : #NEWLINE# #INDENT# self . env . create ( cluster_kwargs = { #NEWLINE# #INDENT# 'net_provider' : consts . CLUSTER_NET_PROVIDERS . neutron , #NEWLINE# 'net_segment_type' : consts . NEUTRON_SEGMENT_TYPES . gre , #NEWLINE# #UNINDENT# } , nodes_kwargs = [ { #NEWLINE# #INDENT# 'api' : True , #NEWLINE# 'pending_addition' : True , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# ng1 = self . env . create_node_group ( name = 'ng_1' ) . json_body #NEWLINE# ng2 = self . env . create_node_group ( name = 'ng_2' ) . json_body #NEWLINE# self . assertEqual ( mocked_rpc . call_count , 0 ) #NEWLINE# self . env . delete_node_group ( ng2 [ 'id' ] ) #NEWLINE# self . assertEqual ( mocked_rpc . call_count , 1 ) #NEWLINE# resp = self . env . delete_node_group ( ng2 [ 'id' ] , status_code = 409 ) #NEWLINE# self . assertEqual ( resp . status_code , 409 ) #NEWLINE# self . assertEqual ( resp . json_body [ 'message' ] , errors . UpdateDnsmasqTaskIsRunning . message ) #NEWLINE# self . assertEqual ( mocked_rpc . call_count , 1 )