1
0
mirror of https://github.com/umputun/reproxy.git synced 2024-11-24 08:12:31 +02:00
reproxy/app/discovery/provider_mock.go

111 lines
2.7 KiB
Go

// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package discovery
import (
"context"
"sync"
)
// Ensure, that ProviderMock does implement Provider.
// If this is not the case, regenerate this file with moq.
var _ Provider = &ProviderMock{}
// ProviderMock is a mock implementation of Provider.
//
// func TestSomethingThatUsesProvider(t *testing.T) {
//
// // make and configure a mocked Provider
// mockedProvider := &ProviderMock{
// EventsFunc: func(ctx context.Context) <-chan ProviderID {
// panic("mock out the Events method")
// },
// ListFunc: func() ([]URLMapper, error) {
// panic("mock out the List method")
// },
// }
//
// // use mockedProvider in code that requires Provider
// // and then make assertions.
//
// }
type ProviderMock struct {
// EventsFunc mocks the Events method.
EventsFunc func(ctx context.Context) <-chan ProviderID
// ListFunc mocks the List method.
ListFunc func() ([]URLMapper, error)
// calls tracks calls to the methods.
calls struct {
// Events holds details about calls to the Events method.
Events []struct {
// Ctx is the ctx argument value.
Ctx context.Context
}
// List holds details about calls to the List method.
List []struct {
}
}
lockEvents sync.RWMutex
lockList sync.RWMutex
}
// Events calls EventsFunc.
func (mock *ProviderMock) Events(ctx context.Context) <-chan ProviderID {
if mock.EventsFunc == nil {
panic("ProviderMock.EventsFunc: method is nil but Provider.Events was just called")
}
callInfo := struct {
Ctx context.Context
}{
Ctx: ctx,
}
mock.lockEvents.Lock()
mock.calls.Events = append(mock.calls.Events, callInfo)
mock.lockEvents.Unlock()
return mock.EventsFunc(ctx)
}
// EventsCalls gets all the calls that were made to Events.
// Check the length with:
// len(mockedProvider.EventsCalls())
func (mock *ProviderMock) EventsCalls() []struct {
Ctx context.Context
} {
var calls []struct {
Ctx context.Context
}
mock.lockEvents.RLock()
calls = mock.calls.Events
mock.lockEvents.RUnlock()
return calls
}
// List calls ListFunc.
func (mock *ProviderMock) List() ([]URLMapper, error) {
if mock.ListFunc == nil {
panic("ProviderMock.ListFunc: method is nil but Provider.List was just called")
}
callInfo := struct {
}{}
mock.lockList.Lock()
mock.calls.List = append(mock.calls.List, callInfo)
mock.lockList.Unlock()
return mock.ListFunc()
}
// ListCalls gets all the calls that were made to List.
// Check the length with:
// len(mockedProvider.ListCalls())
func (mock *ProviderMock) ListCalls() []struct {
} {
var calls []struct {
}
mock.lockList.RLock()
calls = mock.calls.List
mock.lockList.RUnlock()
return calls
}