github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/network/p2p/mock/unicast_management.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 // UnicastManagement is an autogenerated mock type for the UnicastManagement type 17 type UnicastManagement struct { 18 mock.Mock 19 } 20 21 // OpenAndWriteOnStream provides a mock function with given fields: ctx, peerID, protectionTag, writingLogic 22 func (_m *UnicastManagement) OpenAndWriteOnStream(ctx context.Context, peerID peer.ID, protectionTag string, writingLogic func(network.Stream) error) error { 23 ret := _m.Called(ctx, peerID, protectionTag, writingLogic) 24 25 var r0 error 26 if rf, ok := ret.Get(0).(func(context.Context, peer.ID, string, func(network.Stream) error) error); ok { 27 r0 = rf(ctx, peerID, protectionTag, writingLogic) 28 } else { 29 r0 = ret.Error(0) 30 } 31 32 return r0 33 } 34 35 // WithDefaultUnicastProtocol provides a mock function with given fields: defaultHandler, preferred 36 func (_m *UnicastManagement) WithDefaultUnicastProtocol(defaultHandler network.StreamHandler, preferred []protocols.ProtocolName) error { 37 ret := _m.Called(defaultHandler, preferred) 38 39 var r0 error 40 if rf, ok := ret.Get(0).(func(network.StreamHandler, []protocols.ProtocolName) error); ok { 41 r0 = rf(defaultHandler, preferred) 42 } else { 43 r0 = ret.Error(0) 44 } 45 46 return r0 47 } 48 49 type mockConstructorTestingTNewUnicastManagement interface { 50 mock.TestingT 51 Cleanup(func()) 52 } 53 54 // NewUnicastManagement creates a new instance of UnicastManagement. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 55 func NewUnicastManagement(t mockConstructorTestingTNewUnicastManagement) *UnicastManagement { 56 mock := &UnicastManagement{} 57 mock.Mock.Test(t) 58 59 t.Cleanup(func() { mock.AssertExpectations(t) }) 60 61 return mock 62 }