#NEWLINE# @ mock . patch . object ( builtins , 'open' ) #NEWLINE# @ mock . patch ( 'os.path.exists' ) #NEWLINE# def test_get_console_output_exception( self , fake_path_exists , fake_open ) : #NEWLINE# #INDENT# self . _serialops . _pathutils . get_vm_console_log_paths . return_value = [ mock . sentinel . log_path ] #NEWLINE# fake_open . side_effect = IOError #NEWLINE# fake_path_exists . return_value = True #NEWLINE# self . assertRaises ( exception . ConsoleLogOutputException , self . _serialops . get_console_output , mock . sentinel . instance_name ) #NEWLINE# fake_open . assert_called_once_with ( mock . sentinel . log_path , 'rb' )