github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/network/p2p/mock/pub_sub.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  	channels "github.com/onflow/flow-go/network/channels"
     9  
    10  	mock "github.com/stretchr/testify/mock"
    11  
    12  	network "github.com/onflow/flow-go/network"
    13  
    14  	p2p "github.com/onflow/flow-go/network/p2p"
    15  
    16  	peer "github.com/libp2p/go-libp2p/core/peer"
    17  )
    18  
    19  // PubSub is an autogenerated mock type for the PubSub type
    20  type PubSub struct {
    21  	mock.Mock
    22  }
    23  
    24  // GetLocalMeshPeers provides a mock function with given fields: topic
    25  func (_m *PubSub) GetLocalMeshPeers(topic channels.Topic) []peer.ID {
    26  	ret := _m.Called(topic)
    27  
    28  	var r0 []peer.ID
    29  	if rf, ok := ret.Get(0).(func(channels.Topic) []peer.ID); ok {
    30  		r0 = rf(topic)
    31  	} else {
    32  		if ret.Get(0) != nil {
    33  			r0 = ret.Get(0).([]peer.ID)
    34  		}
    35  	}
    36  
    37  	return r0
    38  }
    39  
    40  // Publish provides a mock function with given fields: ctx, messageScope
    41  func (_m *PubSub) Publish(ctx context.Context, messageScope network.OutgoingMessageScope) error {
    42  	ret := _m.Called(ctx, messageScope)
    43  
    44  	var r0 error
    45  	if rf, ok := ret.Get(0).(func(context.Context, network.OutgoingMessageScope) error); ok {
    46  		r0 = rf(ctx, messageScope)
    47  	} else {
    48  		r0 = ret.Error(0)
    49  	}
    50  
    51  	return r0
    52  }
    53  
    54  // SetPubSub provides a mock function with given fields: ps
    55  func (_m *PubSub) SetPubSub(ps p2p.PubSubAdapter) {
    56  	_m.Called(ps)
    57  }
    58  
    59  // Subscribe provides a mock function with given fields: topic, topicValidator
    60  func (_m *PubSub) Subscribe(topic channels.Topic, topicValidator p2p.TopicValidatorFunc) (p2p.Subscription, error) {
    61  	ret := _m.Called(topic, topicValidator)
    62  
    63  	var r0 p2p.Subscription
    64  	var r1 error
    65  	if rf, ok := ret.Get(0).(func(channels.Topic, p2p.TopicValidatorFunc) (p2p.Subscription, error)); ok {
    66  		return rf(topic, topicValidator)
    67  	}
    68  	if rf, ok := ret.Get(0).(func(channels.Topic, p2p.TopicValidatorFunc) p2p.Subscription); ok {
    69  		r0 = rf(topic, topicValidator)
    70  	} else {
    71  		if ret.Get(0) != nil {
    72  			r0 = ret.Get(0).(p2p.Subscription)
    73  		}
    74  	}
    75  
    76  	if rf, ok := ret.Get(1).(func(channels.Topic, p2p.TopicValidatorFunc) error); ok {
    77  		r1 = rf(topic, topicValidator)
    78  	} else {
    79  		r1 = ret.Error(1)
    80  	}
    81  
    82  	return r0, r1
    83  }
    84  
    85  // Unsubscribe provides a mock function with given fields: topic
    86  func (_m *PubSub) Unsubscribe(topic channels.Topic) error {
    87  	ret := _m.Called(topic)
    88  
    89  	var r0 error
    90  	if rf, ok := ret.Get(0).(func(channels.Topic) error); ok {
    91  		r0 = rf(topic)
    92  	} else {
    93  		r0 = ret.Error(0)
    94  	}
    95  
    96  	return r0
    97  }
    98  
    99  type mockConstructorTestingTNewPubSub interface {
   100  	mock.TestingT
   101  	Cleanup(func())
   102  }
   103  
   104  // NewPubSub creates a new instance of PubSub. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
   105  func NewPubSub(t mockConstructorTestingTNewPubSub) *PubSub {
   106  	mock := &PubSub{}
   107  	mock.Mock.Test(t)
   108  
   109  	t.Cleanup(func() { mock.AssertExpectations(t) })
   110  
   111  	return mock
   112  }