github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/network/p2p/mock/unicast_manager.go (about) 1 // Code generated by mockery v2.21.4. DO NOT EDIT. 2 3 package mockp2p 4 5 import ( 6 context "context" 7 8 network "github.com/libp2p/go-libp2p/core/network" 9 mock "github.com/stretchr/testify/mock" 10 11 peer "github.com/libp2p/go-libp2p/core/peer" 12 13 protocols "github.com/onflow/flow-go/network/p2p/unicast/protocols" 14 ) 15 16 // UnicastManager is an autogenerated mock type for the UnicastManager type 17 type UnicastManager struct { 18 mock.Mock 19 } 20 21 // CreateStream provides a mock function with given fields: ctx, peerID 22 func (_m *UnicastManager) CreateStream(ctx context.Context, peerID peer.ID) (network.Stream, error) { 23 ret := _m.Called(ctx, peerID) 24 25 var r0 network.Stream 26 var r1 error 27 if rf, ok := ret.Get(0).(func(context.Context, peer.ID) (network.Stream, error)); ok { 28 return rf(ctx, peerID) 29 } 30 if rf, ok := ret.Get(0).(func(context.Context, peer.ID) network.Stream); ok { 31 r0 = rf(ctx, peerID) 32 } else { 33 if ret.Get(0) != nil { 34 r0 = ret.Get(0).(network.Stream) 35 } 36 } 37 38 if rf, ok := ret.Get(1).(func(context.Context, peer.ID) error); ok { 39 r1 = rf(ctx, peerID) 40 } else { 41 r1 = ret.Error(1) 42 } 43 44 return r0, r1 45 } 46 47 // Register provides a mock function with given fields: unicast 48 func (_m *UnicastManager) Register(unicast protocols.ProtocolName) error { 49 ret := _m.Called(unicast) 50 51 var r0 error 52 if rf, ok := ret.Get(0).(func(protocols.ProtocolName) error); ok { 53 r0 = rf(unicast) 54 } else { 55 r0 = ret.Error(0) 56 } 57 58 return r0 59 } 60 61 // SetDefaultHandler provides a mock function with given fields: defaultHandler 62 func (_m *UnicastManager) SetDefaultHandler(defaultHandler network.StreamHandler) { 63 _m.Called(defaultHandler) 64 } 65 66 type mockConstructorTestingTNewUnicastManager interface { 67 mock.TestingT 68 Cleanup(func()) 69 } 70 71 // NewUnicastManager creates a new instance of UnicastManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 72 func NewUnicastManager(t mockConstructorTestingTNewUnicastManager) *UnicastManager { 73 mock := &UnicastManager{} 74 mock.Mock.Test(t) 75 76 t.Cleanup(func() { mock.AssertExpectations(t) }) 77 78 return mock 79 }