#NEWLINE# def test_get_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 . get_power_state . side_effect = exc #NEWLINE# with task_manager . acquire ( self . context , self . node . uuid , shared = True ) as task : #NEWLINE# #INDENT# self . assertRaises ( exception . DracOperationError , task . driver . power . get_power_state , task ) #NEWLINE# #UNINDENT# mock_client . get_power_state . assert_called_once_with ( )