#NEWLINE# @ mock . patch . object ( serialconsolehandler . utilsfactory , 'get_named_pipe_handler' ) #NEWLINE# def _test_get_named_pipe_handler( self , mock_get_pipe_handler , pipe_type = None , enable_logging = False ) : #NEWLINE# #INDENT# expected_args = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( pipe_type == constants . SERIAL_PORT_TYPE_RW ) : #NEWLINE# #INDENT# self . _consolehandler . _input_queue = mock . sentinel . input_queue #NEWLINE# self . _consolehandler . _output_queue = mock . sentinel . output_queue #NEWLINE# self . _consolehandler . _client_connected = mock . sentinel . connect_event #NEWLINE# expected_args . update ( { #NEWLINE# #INDENT# 'input_queue' : mock . sentinel . input_queue , #NEWLINE# 'output_queue' : mock . sentinel . output_queue , #NEWLINE# 'connect_event' : mock . sentinel . connect_event , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# if enable_logging : #NEWLINE# #INDENT# expected_args [ 'log_file' ] = mock . sentinel . log_path #NEWLINE# #UNINDENT# ret_val = self . _consolehandler . _get_named_pipe_handler ( mock . sentinel . pipe_path , pipe_type , enable_logging ) #NEWLINE# self . assertEqual ( mock_get_pipe_handler . return_value , ret_val ) #NEWLINE# mock_get_pipe_handler . assert_called_once_with ( mock . sentinel . pipe_path , ** expected_args )