#NEWLINE# def test_set_power_state_fail( self , mock_get_drac_client ) : #NEWLINE# #INDENT# mock_client = mock_get_drac_client . return_value #NEWLINE# exc = drac_exceptions . BaseClientException ( 'boom' ) #NEWLINE# mock_client . set_power_state . side_effect = exc #NEWLINE# with task_manager . acquire ( self . context , self . node . uuid , shared = False ) as task : #NEWLINE# #INDENT# self . assertRaises ( exception . DracOperationError , task . driver . power . set_power_state , task , states . POWER_OFF ) #NEWLINE# #UNINDENT# drac_power_state = drac_power . REVERSE_POWER_STATES [ states . POWER_OFF ] #NEWLINE# mock_client . set_power_state . assert_called_once_with ( drac_power_state )