123 lines
3.5 KiB
Go
123 lines
3.5 KiB
Go
// SPDX-FileCopyrightText: 2021 The NGI Pointer Secure-Scuttlebutt Team of 2020/2021
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// Code generated by counterfeiter. DO NOT EDIT.
|
|
package mocked
|
|
|
|
import (
|
|
"sync"
|
|
|
|
muxrpc "github.com/ssbc/go-muxrpc/v2"
|
|
refs "github.com/ssbc/go-ssb-refs"
|
|
"github.com/ssbc/go-ssb-room/v2/internal/network"
|
|
)
|
|
|
|
type FakeEndpoints struct {
|
|
GetEndpointForStub func(refs.FeedRef) (muxrpc.Endpoint, bool)
|
|
getEndpointForMutex sync.RWMutex
|
|
getEndpointForArgsForCall []struct {
|
|
arg1 refs.FeedRef
|
|
}
|
|
getEndpointForReturns struct {
|
|
result1 muxrpc.Endpoint
|
|
result2 bool
|
|
}
|
|
getEndpointForReturnsOnCall map[int]struct {
|
|
result1 muxrpc.Endpoint
|
|
result2 bool
|
|
}
|
|
invocations map[string][][]interface{}
|
|
invocationsMutex sync.RWMutex
|
|
}
|
|
|
|
func (fake *FakeEndpoints) GetEndpointFor(arg1 refs.FeedRef) (muxrpc.Endpoint, bool) {
|
|
fake.getEndpointForMutex.Lock()
|
|
ret, specificReturn := fake.getEndpointForReturnsOnCall[len(fake.getEndpointForArgsForCall)]
|
|
fake.getEndpointForArgsForCall = append(fake.getEndpointForArgsForCall, struct {
|
|
arg1 refs.FeedRef
|
|
}{arg1})
|
|
stub := fake.GetEndpointForStub
|
|
fakeReturns := fake.getEndpointForReturns
|
|
fake.recordInvocation("GetEndpointFor", []interface{}{arg1})
|
|
fake.getEndpointForMutex.Unlock()
|
|
if stub != nil {
|
|
return stub(arg1)
|
|
}
|
|
if specificReturn {
|
|
return ret.result1, ret.result2
|
|
}
|
|
return fakeReturns.result1, fakeReturns.result2
|
|
}
|
|
|
|
func (fake *FakeEndpoints) GetEndpointForCallCount() int {
|
|
fake.getEndpointForMutex.RLock()
|
|
defer fake.getEndpointForMutex.RUnlock()
|
|
return len(fake.getEndpointForArgsForCall)
|
|
}
|
|
|
|
func (fake *FakeEndpoints) GetEndpointForCalls(stub func(refs.FeedRef) (muxrpc.Endpoint, bool)) {
|
|
fake.getEndpointForMutex.Lock()
|
|
defer fake.getEndpointForMutex.Unlock()
|
|
fake.GetEndpointForStub = stub
|
|
}
|
|
|
|
func (fake *FakeEndpoints) GetEndpointForArgsForCall(i int) refs.FeedRef {
|
|
fake.getEndpointForMutex.RLock()
|
|
defer fake.getEndpointForMutex.RUnlock()
|
|
argsForCall := fake.getEndpointForArgsForCall[i]
|
|
return argsForCall.arg1
|
|
}
|
|
|
|
func (fake *FakeEndpoints) GetEndpointForReturns(result1 muxrpc.Endpoint, result2 bool) {
|
|
fake.getEndpointForMutex.Lock()
|
|
defer fake.getEndpointForMutex.Unlock()
|
|
fake.GetEndpointForStub = nil
|
|
fake.getEndpointForReturns = struct {
|
|
result1 muxrpc.Endpoint
|
|
result2 bool
|
|
}{result1, result2}
|
|
}
|
|
|
|
func (fake *FakeEndpoints) GetEndpointForReturnsOnCall(i int, result1 muxrpc.Endpoint, result2 bool) {
|
|
fake.getEndpointForMutex.Lock()
|
|
defer fake.getEndpointForMutex.Unlock()
|
|
fake.GetEndpointForStub = nil
|
|
if fake.getEndpointForReturnsOnCall == nil {
|
|
fake.getEndpointForReturnsOnCall = make(map[int]struct {
|
|
result1 muxrpc.Endpoint
|
|
result2 bool
|
|
})
|
|
}
|
|
fake.getEndpointForReturnsOnCall[i] = struct {
|
|
result1 muxrpc.Endpoint
|
|
result2 bool
|
|
}{result1, result2}
|
|
}
|
|
|
|
func (fake *FakeEndpoints) Invocations() map[string][][]interface{} {
|
|
fake.invocationsMutex.RLock()
|
|
defer fake.invocationsMutex.RUnlock()
|
|
fake.getEndpointForMutex.RLock()
|
|
defer fake.getEndpointForMutex.RUnlock()
|
|
copiedInvocations := map[string][][]interface{}{}
|
|
for key, value := range fake.invocations {
|
|
copiedInvocations[key] = value
|
|
}
|
|
return copiedInvocations
|
|
}
|
|
|
|
func (fake *FakeEndpoints) recordInvocation(key string, args []interface{}) {
|
|
fake.invocationsMutex.Lock()
|
|
defer fake.invocationsMutex.Unlock()
|
|
if fake.invocations == nil {
|
|
fake.invocations = map[string][][]interface{}{}
|
|
}
|
|
if fake.invocations[key] == nil {
|
|
fake.invocations[key] = [][]interface{}{}
|
|
}
|
|
fake.invocations[key] = append(fake.invocations[key], args)
|
|
}
|
|
|
|
var _ network.Endpoints = new(FakeEndpoints)
|