github.com/pure-x-eth/consensus_tm@v0.0.0-20230502163723-e3c2ff987250/p2p/mocks/peer.go (about)

     1  // Code generated by mockery. DO NOT EDIT.
     2  
     3  package mocks
     4  
     5  import (
     6  	log "github.com/pure-x-eth/consensus_tm/libs/log"
     7  	conn "github.com/pure-x-eth/consensus_tm/p2p/conn"
     8  
     9  	mock "github.com/stretchr/testify/mock"
    10  
    11  	net "net"
    12  
    13  	p2p "github.com/pure-x-eth/consensus_tm/p2p"
    14  )
    15  
    16  // Peer is an autogenerated mock type for the Peer type
    17  type Peer struct {
    18  	mock.Mock
    19  }
    20  
    21  // CloseConn provides a mock function with given fields:
    22  func (_m *Peer) CloseConn() error {
    23  	ret := _m.Called()
    24  
    25  	var r0 error
    26  	if rf, ok := ret.Get(0).(func() error); ok {
    27  		r0 = rf()
    28  	} else {
    29  		r0 = ret.Error(0)
    30  	}
    31  
    32  	return r0
    33  }
    34  
    35  // FlushStop provides a mock function with given fields:
    36  func (_m *Peer) FlushStop() {
    37  	_m.Called()
    38  }
    39  
    40  // Get provides a mock function with given fields: _a0
    41  func (_m *Peer) Get(_a0 string) interface{} {
    42  	ret := _m.Called(_a0)
    43  
    44  	var r0 interface{}
    45  	if rf, ok := ret.Get(0).(func(string) interface{}); ok {
    46  		r0 = rf(_a0)
    47  	} else {
    48  		if ret.Get(0) != nil {
    49  			r0 = ret.Get(0).(interface{})
    50  		}
    51  	}
    52  
    53  	return r0
    54  }
    55  
    56  // GetRemovalFailed provides a mock function with given fields:
    57  func (_m *Peer) GetRemovalFailed() bool {
    58  	ret := _m.Called()
    59  
    60  	var r0 bool
    61  	if rf, ok := ret.Get(0).(func() bool); ok {
    62  		r0 = rf()
    63  	} else {
    64  		r0 = ret.Get(0).(bool)
    65  	}
    66  
    67  	return r0
    68  }
    69  
    70  // ID provides a mock function with given fields:
    71  func (_m *Peer) ID() p2p.ID {
    72  	ret := _m.Called()
    73  
    74  	var r0 p2p.ID
    75  	if rf, ok := ret.Get(0).(func() p2p.ID); ok {
    76  		r0 = rf()
    77  	} else {
    78  		r0 = ret.Get(0).(p2p.ID)
    79  	}
    80  
    81  	return r0
    82  }
    83  
    84  // IsOutbound provides a mock function with given fields:
    85  func (_m *Peer) IsOutbound() bool {
    86  	ret := _m.Called()
    87  
    88  	var r0 bool
    89  	if rf, ok := ret.Get(0).(func() bool); ok {
    90  		r0 = rf()
    91  	} else {
    92  		r0 = ret.Get(0).(bool)
    93  	}
    94  
    95  	return r0
    96  }
    97  
    98  // IsPersistent provides a mock function with given fields:
    99  func (_m *Peer) IsPersistent() bool {
   100  	ret := _m.Called()
   101  
   102  	var r0 bool
   103  	if rf, ok := ret.Get(0).(func() bool); ok {
   104  		r0 = rf()
   105  	} else {
   106  		r0 = ret.Get(0).(bool)
   107  	}
   108  
   109  	return r0
   110  }
   111  
   112  // IsRunning provides a mock function with given fields:
   113  func (_m *Peer) IsRunning() bool {
   114  	ret := _m.Called()
   115  
   116  	var r0 bool
   117  	if rf, ok := ret.Get(0).(func() bool); ok {
   118  		r0 = rf()
   119  	} else {
   120  		r0 = ret.Get(0).(bool)
   121  	}
   122  
   123  	return r0
   124  }
   125  
   126  // SendEnvelope provides a mock function with given fields: _a0
   127  func (_m *Peer) SendEnvelope(_a0 p2p.Envelope) bool {
   128  	ret := _m.Called(_a0)
   129  
   130  	var r0 bool
   131  	if rf, ok := ret.Get(0).(func(p2p.Envelope) bool); ok {
   132  		r0 = rf(_a0)
   133  	} else {
   134  		r0 = ret.Get(0).(bool)
   135  	}
   136  
   137  	return r0
   138  }
   139  
   140  // TrySendEnvelope provides a mock function with given fields: _a0
   141  func (_m *Peer) TrySendEnvelope(_a0 p2p.Envelope) bool {
   142  	ret := _m.Called(_a0)
   143  
   144  	var r0 bool
   145  	if rf, ok := ret.Get(0).(func(p2p.Envelope) bool); ok {
   146  		r0 = rf(_a0)
   147  	} else {
   148  		r0 = ret.Get(0).(bool)
   149  	}
   150  
   151  	return r0
   152  }
   153  
   154  // NodeInfo provides a mock function with given fields:
   155  func (_m *Peer) NodeInfo() p2p.NodeInfo {
   156  	ret := _m.Called()
   157  
   158  	var r0 p2p.NodeInfo
   159  	if rf, ok := ret.Get(0).(func() p2p.NodeInfo); ok {
   160  		r0 = rf()
   161  	} else {
   162  		if ret.Get(0) != nil {
   163  			r0 = ret.Get(0).(p2p.NodeInfo)
   164  		}
   165  	}
   166  
   167  	return r0
   168  }
   169  
   170  // OnReset provides a mock function with given fields:
   171  func (_m *Peer) OnReset() error {
   172  	ret := _m.Called()
   173  
   174  	var r0 error
   175  	if rf, ok := ret.Get(0).(func() error); ok {
   176  		r0 = rf()
   177  	} else {
   178  		r0 = ret.Error(0)
   179  	}
   180  
   181  	return r0
   182  }
   183  
   184  // OnStart provides a mock function with given fields:
   185  func (_m *Peer) OnStart() error {
   186  	ret := _m.Called()
   187  
   188  	var r0 error
   189  	if rf, ok := ret.Get(0).(func() error); ok {
   190  		r0 = rf()
   191  	} else {
   192  		r0 = ret.Error(0)
   193  	}
   194  
   195  	return r0
   196  }
   197  
   198  // OnStop provides a mock function with given fields:
   199  func (_m *Peer) OnStop() {
   200  	_m.Called()
   201  }
   202  
   203  // Quit provides a mock function with given fields:
   204  func (_m *Peer) Quit() <-chan struct{} {
   205  	ret := _m.Called()
   206  
   207  	var r0 <-chan struct{}
   208  	if rf, ok := ret.Get(0).(func() <-chan struct{}); ok {
   209  		r0 = rf()
   210  	} else {
   211  		if ret.Get(0) != nil {
   212  			r0 = ret.Get(0).(<-chan struct{})
   213  		}
   214  	}
   215  
   216  	return r0
   217  }
   218  
   219  // RemoteAddr provides a mock function with given fields:
   220  func (_m *Peer) RemoteAddr() net.Addr {
   221  	ret := _m.Called()
   222  
   223  	var r0 net.Addr
   224  	if rf, ok := ret.Get(0).(func() net.Addr); ok {
   225  		r0 = rf()
   226  	} else {
   227  		if ret.Get(0) != nil {
   228  			r0 = ret.Get(0).(net.Addr)
   229  		}
   230  	}
   231  
   232  	return r0
   233  }
   234  
   235  // RemoteIP provides a mock function with given fields:
   236  func (_m *Peer) RemoteIP() net.IP {
   237  	ret := _m.Called()
   238  
   239  	var r0 net.IP
   240  	if rf, ok := ret.Get(0).(func() net.IP); ok {
   241  		r0 = rf()
   242  	} else {
   243  		if ret.Get(0) != nil {
   244  			r0 = ret.Get(0).(net.IP)
   245  		}
   246  	}
   247  
   248  	return r0
   249  }
   250  
   251  // Reset provides a mock function with given fields:
   252  func (_m *Peer) Reset() error {
   253  	ret := _m.Called()
   254  
   255  	var r0 error
   256  	if rf, ok := ret.Get(0).(func() error); ok {
   257  		r0 = rf()
   258  	} else {
   259  		r0 = ret.Error(0)
   260  	}
   261  
   262  	return r0
   263  }
   264  
   265  // Send provides a mock function with given fields: _a0, _a1
   266  func (_m *Peer) Send(_a0 byte, _a1 []byte) bool {
   267  	ret := _m.Called(_a0, _a1)
   268  
   269  	var r0 bool
   270  	if rf, ok := ret.Get(0).(func(byte, []byte) bool); ok {
   271  		r0 = rf(_a0, _a1)
   272  	} else {
   273  		r0 = ret.Get(0).(bool)
   274  	}
   275  
   276  	return r0
   277  }
   278  
   279  // Set provides a mock function with given fields: _a0, _a1
   280  func (_m *Peer) Set(_a0 string, _a1 interface{}) {
   281  	_m.Called(_a0, _a1)
   282  }
   283  
   284  // SetLogger provides a mock function with given fields: _a0
   285  func (_m *Peer) SetLogger(_a0 log.Logger) {
   286  	_m.Called(_a0)
   287  }
   288  
   289  // SetRemovalFailed provides a mock function with given fields:
   290  func (_m *Peer) SetRemovalFailed() {
   291  	_m.Called()
   292  }
   293  
   294  // SocketAddr provides a mock function with given fields:
   295  func (_m *Peer) SocketAddr() *p2p.NetAddress {
   296  	ret := _m.Called()
   297  
   298  	var r0 *p2p.NetAddress
   299  	if rf, ok := ret.Get(0).(func() *p2p.NetAddress); ok {
   300  		r0 = rf()
   301  	} else {
   302  		if ret.Get(0) != nil {
   303  			r0 = ret.Get(0).(*p2p.NetAddress)
   304  		}
   305  	}
   306  
   307  	return r0
   308  }
   309  
   310  // Start provides a mock function with given fields:
   311  func (_m *Peer) Start() error {
   312  	ret := _m.Called()
   313  
   314  	var r0 error
   315  	if rf, ok := ret.Get(0).(func() error); ok {
   316  		r0 = rf()
   317  	} else {
   318  		r0 = ret.Error(0)
   319  	}
   320  
   321  	return r0
   322  }
   323  
   324  // Status provides a mock function with given fields:
   325  func (_m *Peer) Status() conn.ConnectionStatus {
   326  	ret := _m.Called()
   327  
   328  	var r0 conn.ConnectionStatus
   329  	if rf, ok := ret.Get(0).(func() conn.ConnectionStatus); ok {
   330  		r0 = rf()
   331  	} else {
   332  		r0 = ret.Get(0).(conn.ConnectionStatus)
   333  	}
   334  
   335  	return r0
   336  }
   337  
   338  // Stop provides a mock function with given fields:
   339  func (_m *Peer) Stop() error {
   340  	ret := _m.Called()
   341  
   342  	var r0 error
   343  	if rf, ok := ret.Get(0).(func() error); ok {
   344  		r0 = rf()
   345  	} else {
   346  		r0 = ret.Error(0)
   347  	}
   348  
   349  	return r0
   350  }
   351  
   352  // String provides a mock function with given fields:
   353  func (_m *Peer) String() string {
   354  	ret := _m.Called()
   355  
   356  	var r0 string
   357  	if rf, ok := ret.Get(0).(func() string); ok {
   358  		r0 = rf()
   359  	} else {
   360  		r0 = ret.Get(0).(string)
   361  	}
   362  
   363  	return r0
   364  }
   365  
   366  // TrySend provides a mock function with given fields: _a0, _a1
   367  func (_m *Peer) TrySend(_a0 byte, _a1 []byte) bool {
   368  	ret := _m.Called(_a0, _a1)
   369  
   370  	var r0 bool
   371  	if rf, ok := ret.Get(0).(func(byte, []byte) bool); ok {
   372  		r0 = rf(_a0, _a1)
   373  	} else {
   374  		r0 = ret.Get(0).(bool)
   375  	}
   376  
   377  	return r0
   378  }
   379  
   380  type NewPeerT interface {
   381  	mock.TestingT
   382  	Cleanup(func())
   383  }
   384  
   385  // NewPeer creates a new instance of Peer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
   386  func NewPeer(t NewPeerT) *Peer {
   387  	mock := &Peer{}
   388  	mock.Mock.Test(t)
   389  
   390  	t.Cleanup(func() { mock.AssertExpectations(t) })
   391  
   392  	return mock
   393  }