#NEWLINE# @ mock . patch ( 'hm.lb_managers.cloudstack.CloudStack' ) #NEWLINE# def test_destroy_load_balancer( self , cs_mock ) : #NEWLINE# #INDENT# cs_instance = cs_mock . return_value #NEWLINE# cs_instance . deleteLoadBalancerRule . return_value = { #NEWLINE# #INDENT# 'jobid' : 'j1' , #NEWLINE# #UNINDENT# } #NEWLINE# cs_instance . make_request . return_value = { #NEWLINE# #INDENT# 'jobid' : 'j2' , #NEWLINE# #UNINDENT# } #NEWLINE# lb = load_balancer . LoadBalancer ( 'lbid' , 'lbname' , 'lbaddr' , ip_id = 'ipid' , project_id = 'projid' ) #NEWLINE# manager = cloudstack . CloudstackLB ( self . conf ) #NEWLINE# manager . destroy_load_balancer ( manager ) #NEWLINE# cs_instance . deleteLoadBalancerRule . assert_called_once_with ( { #NEWLINE# #INDENT# 'id' : 'lbid' , #NEWLINE# 'projectid' : 'projid' , #NEWLINE# #UNINDENT# } ) #NEWLINE# cs_instance . make_request . assert_called_once_with ( 'disassociateIpAddress' , { #NEWLINE# #INDENT# 'id' : 'ipid' , #NEWLINE# 'projectid' : 'projid' , #NEWLINE# #UNINDENT# } ) #NEWLINE# cs_instance . wait_for_job . assert_any_call ( 'j1' , 100 ) #NEWLINE# cs_instance . wait_for_job . assert_any_call ( 'j2' , 100 )