mock

package
v0.10.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KVStoreMock

type KVStoreMock struct {
	// CacheWrapFunc mocks the CacheWrap method.
	CacheWrapFunc func() types.CacheWrap

	// CacheWrapWithListenersFunc mocks the CacheWrapWithListeners method.
	CacheWrapWithListenersFunc func(storeKey types.StoreKey, listeners []types.WriteListener) types.CacheWrap

	// CacheWrapWithTraceFunc mocks the CacheWrapWithTrace method.
	CacheWrapWithTraceFunc func(w io.Writer, tc types.TraceContext) types.CacheWrap

	// DeleteFunc mocks the Delete method.
	DeleteFunc func(key []byte)

	// GetFunc mocks the Get method.
	GetFunc func(key []byte) []byte

	// GetStoreTypeFunc mocks the GetStoreType method.
	GetStoreTypeFunc func() types.StoreType

	// HasFunc mocks the Has method.
	HasFunc func(key []byte) bool

	// IteratorFunc mocks the Iterator method.
	IteratorFunc func(start []byte, end []byte) db.Iterator

	// ReverseIteratorFunc mocks the ReverseIterator method.
	ReverseIteratorFunc func(start []byte, end []byte) db.Iterator

	// SetFunc mocks the Set method.
	SetFunc func(key []byte, value []byte)
	// contains filtered or unexported fields
}

KVStoreMock is a mock implementation of interfaces.KVStore.

func TestSomethingThatUsesKVStore(t *testing.T) {

	// make and configure a mocked interfaces.KVStore
	mockedKVStore := &KVStoreMock{
		CacheWrapFunc: func() types.CacheWrap {
			panic("mock out the CacheWrap method")
		},
		CacheWrapWithListenersFunc: func(storeKey types.StoreKey, listeners []types.WriteListener) types.CacheWrap {
			panic("mock out the CacheWrapWithListeners method")
		},
		CacheWrapWithTraceFunc: func(w io.Writer, tc types.TraceContext) types.CacheWrap {
			panic("mock out the CacheWrapWithTrace method")
		},
		DeleteFunc: func(key []byte)  {
			panic("mock out the Delete method")
		},
		GetFunc: func(key []byte) []byte {
			panic("mock out the Get method")
		},
		GetStoreTypeFunc: func() types.StoreType {
			panic("mock out the GetStoreType method")
		},
		HasFunc: func(key []byte) bool {
			panic("mock out the Has method")
		},
		IteratorFunc: func(start []byte, end []byte) db.Iterator {
			panic("mock out the Iterator method")
		},
		ReverseIteratorFunc: func(start []byte, end []byte) db.Iterator {
			panic("mock out the ReverseIterator method")
		},
		SetFunc: func(key []byte, value []byte)  {
			panic("mock out the Set method")
		},
	}

	// use mockedKVStore in code that requires interfaces.KVStore
	// and then make assertions.

}

func (*KVStoreMock) CacheWrap

func (mock *KVStoreMock) CacheWrap() types.CacheWrap

CacheWrap calls CacheWrapFunc.

func (*KVStoreMock) CacheWrapCalls

func (mock *KVStoreMock) CacheWrapCalls() []struct {
}

CacheWrapCalls gets all the calls that were made to CacheWrap. Check the length with:

len(mockedKVStore.CacheWrapCalls())

func (*KVStoreMock) CacheWrapWithListeners

func (mock *KVStoreMock) CacheWrapWithListeners(storeKey types.StoreKey, listeners []types.WriteListener) types.CacheWrap

CacheWrapWithListeners calls CacheWrapWithListenersFunc.

func (*KVStoreMock) CacheWrapWithListenersCalls

func (mock *KVStoreMock) CacheWrapWithListenersCalls() []struct {
	StoreKey  types.StoreKey
	Listeners []types.WriteListener
}

CacheWrapWithListenersCalls gets all the calls that were made to CacheWrapWithListeners. Check the length with:

len(mockedKVStore.CacheWrapWithListenersCalls())

func (*KVStoreMock) CacheWrapWithTrace

func (mock *KVStoreMock) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap

CacheWrapWithTrace calls CacheWrapWithTraceFunc.

func (*KVStoreMock) CacheWrapWithTraceCalls

func (mock *KVStoreMock) CacheWrapWithTraceCalls() []struct {
	W  io.Writer
	Tc types.TraceContext
}

CacheWrapWithTraceCalls gets all the calls that were made to CacheWrapWithTrace. Check the length with:

len(mockedKVStore.CacheWrapWithTraceCalls())

func (*KVStoreMock) Delete

func (mock *KVStoreMock) Delete(key []byte)

Delete calls DeleteFunc.

func (*KVStoreMock) DeleteCalls

func (mock *KVStoreMock) DeleteCalls() []struct {
	Key []byte
}

DeleteCalls gets all the calls that were made to Delete. Check the length with:

len(mockedKVStore.DeleteCalls())

func (*KVStoreMock) Get

func (mock *KVStoreMock) Get(key []byte) []byte

Get calls GetFunc.

func (*KVStoreMock) GetCalls

func (mock *KVStoreMock) GetCalls() []struct {
	Key []byte
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedKVStore.GetCalls())

func (*KVStoreMock) GetStoreType

func (mock *KVStoreMock) GetStoreType() types.StoreType

GetStoreType calls GetStoreTypeFunc.

func (*KVStoreMock) GetStoreTypeCalls

func (mock *KVStoreMock) GetStoreTypeCalls() []struct {
}

GetStoreTypeCalls gets all the calls that were made to GetStoreType. Check the length with:

len(mockedKVStore.GetStoreTypeCalls())

func (*KVStoreMock) Has

func (mock *KVStoreMock) Has(key []byte) bool

Has calls HasFunc.

func (*KVStoreMock) HasCalls

func (mock *KVStoreMock) HasCalls() []struct {
	Key []byte
}

HasCalls gets all the calls that were made to Has. Check the length with:

len(mockedKVStore.HasCalls())

func (*KVStoreMock) Iterator

func (mock *KVStoreMock) Iterator(start []byte, end []byte) db.Iterator

Iterator calls IteratorFunc.

func (*KVStoreMock) IteratorCalls

func (mock *KVStoreMock) IteratorCalls() []struct {
	Start []byte
	End   []byte
}

IteratorCalls gets all the calls that were made to Iterator. Check the length with:

len(mockedKVStore.IteratorCalls())

func (*KVStoreMock) ReverseIterator

func (mock *KVStoreMock) ReverseIterator(start []byte, end []byte) db.Iterator

ReverseIterator calls ReverseIteratorFunc.

func (*KVStoreMock) ReverseIteratorCalls

func (mock *KVStoreMock) ReverseIteratorCalls() []struct {
	Start []byte
	End   []byte
}

ReverseIteratorCalls gets all the calls that were made to ReverseIterator. Check the length with:

len(mockedKVStore.ReverseIteratorCalls())

func (*KVStoreMock) Set

func (mock *KVStoreMock) Set(key []byte, value []byte)

Set calls SetFunc.

func (*KVStoreMock) SetCalls

func (mock *KVStoreMock) SetCalls() []struct {
	Key   []byte
	Value []byte
}

SetCalls gets all the calls that were made to Set. Check the length with:

len(mockedKVStore.SetCalls())

type MultiStoreMock

type MultiStoreMock struct {
	// AddListenersFunc mocks the AddListeners method.
	AddListenersFunc func(key types.StoreKey, listeners []types.WriteListener)

	// CacheMultiStoreFunc mocks the CacheMultiStore method.
	CacheMultiStoreFunc func() types.CacheMultiStore

	// CacheMultiStoreWithVersionFunc mocks the CacheMultiStoreWithVersion method.
	CacheMultiStoreWithVersionFunc func(version int64) (types.CacheMultiStore, error)

	// CacheWrapFunc mocks the CacheWrap method.
	CacheWrapFunc func() types.CacheWrap

	// CacheWrapWithListenersFunc mocks the CacheWrapWithListeners method.
	CacheWrapWithListenersFunc func(storeKey types.StoreKey, listeners []types.WriteListener) types.CacheWrap

	// CacheWrapWithTraceFunc mocks the CacheWrapWithTrace method.
	CacheWrapWithTraceFunc func(w io.Writer, tc types.TraceContext) types.CacheWrap

	// GetKVStoreFunc mocks the GetKVStore method.
	GetKVStoreFunc func(storeKey types.StoreKey) types.KVStore

	// GetStoreFunc mocks the GetStore method.
	GetStoreFunc func(storeKey types.StoreKey) types.Store

	// GetStoreTypeFunc mocks the GetStoreType method.
	GetStoreTypeFunc func() types.StoreType

	// ListeningEnabledFunc mocks the ListeningEnabled method.
	ListeningEnabledFunc func(key types.StoreKey) bool

	// SetTracerFunc mocks the SetTracer method.
	SetTracerFunc func(w io.Writer) types.MultiStore

	// SetTracingContextFunc mocks the SetTracingContext method.
	SetTracingContextFunc func(traceContext types.TraceContext) types.MultiStore

	// TracingEnabledFunc mocks the TracingEnabled method.
	TracingEnabledFunc func() bool
	// contains filtered or unexported fields
}

MultiStoreMock is a mock implementation of interfaces.MultiStore.

func TestSomethingThatUsesMultiStore(t *testing.T) {

	// make and configure a mocked interfaces.MultiStore
	mockedMultiStore := &MultiStoreMock{
		AddListenersFunc: func(key types.StoreKey, listeners []types.WriteListener)  {
			panic("mock out the AddListeners method")
		},
		CacheMultiStoreFunc: func() types.CacheMultiStore {
			panic("mock out the CacheMultiStore method")
		},
		CacheMultiStoreWithVersionFunc: func(version int64) (types.CacheMultiStore, error) {
			panic("mock out the CacheMultiStoreWithVersion method")
		},
		CacheWrapFunc: func() types.CacheWrap {
			panic("mock out the CacheWrap method")
		},
		CacheWrapWithListenersFunc: func(storeKey types.StoreKey, listeners []types.WriteListener) types.CacheWrap {
			panic("mock out the CacheWrapWithListeners method")
		},
		CacheWrapWithTraceFunc: func(w io.Writer, tc types.TraceContext) types.CacheWrap {
			panic("mock out the CacheWrapWithTrace method")
		},
		GetKVStoreFunc: func(storeKey types.StoreKey) types.KVStore {
			panic("mock out the GetKVStore method")
		},
		GetStoreFunc: func(storeKey types.StoreKey) types.Store {
			panic("mock out the GetStore method")
		},
		GetStoreTypeFunc: func() types.StoreType {
			panic("mock out the GetStoreType method")
		},
		ListeningEnabledFunc: func(key types.StoreKey) bool {
			panic("mock out the ListeningEnabled method")
		},
		SetTracerFunc: func(w io.Writer) types.MultiStore {
			panic("mock out the SetTracer method")
		},
		SetTracingContextFunc: func(traceContext types.TraceContext) types.MultiStore {
			panic("mock out the SetTracingContext method")
		},
		TracingEnabledFunc: func() bool {
			panic("mock out the TracingEnabled method")
		},
	}

	// use mockedMultiStore in code that requires interfaces.MultiStore
	// and then make assertions.

}

func (*MultiStoreMock) AddListeners

func (mock *MultiStoreMock) AddListeners(key types.StoreKey, listeners []types.WriteListener)

AddListeners calls AddListenersFunc.

func (*MultiStoreMock) AddListenersCalls

func (mock *MultiStoreMock) AddListenersCalls() []struct {
	Key       types.StoreKey
	Listeners []types.WriteListener
}

AddListenersCalls gets all the calls that were made to AddListeners. Check the length with:

len(mockedMultiStore.AddListenersCalls())

func (*MultiStoreMock) CacheMultiStore

func (mock *MultiStoreMock) CacheMultiStore() types.CacheMultiStore

CacheMultiStore calls CacheMultiStoreFunc.

func (*MultiStoreMock) CacheMultiStoreCalls

func (mock *MultiStoreMock) CacheMultiStoreCalls() []struct {
}

CacheMultiStoreCalls gets all the calls that were made to CacheMultiStore. Check the length with:

len(mockedMultiStore.CacheMultiStoreCalls())

func (*MultiStoreMock) CacheMultiStoreWithVersion

func (mock *MultiStoreMock) CacheMultiStoreWithVersion(version int64) (types.CacheMultiStore, error)

CacheMultiStoreWithVersion calls CacheMultiStoreWithVersionFunc.

func (*MultiStoreMock) CacheMultiStoreWithVersionCalls

func (mock *MultiStoreMock) CacheMultiStoreWithVersionCalls() []struct {
	Version int64
}

CacheMultiStoreWithVersionCalls gets all the calls that were made to CacheMultiStoreWithVersion. Check the length with:

len(mockedMultiStore.CacheMultiStoreWithVersionCalls())

func (*MultiStoreMock) CacheWrap

func (mock *MultiStoreMock) CacheWrap() types.CacheWrap

CacheWrap calls CacheWrapFunc.

func (*MultiStoreMock) CacheWrapCalls

func (mock *MultiStoreMock) CacheWrapCalls() []struct {
}

CacheWrapCalls gets all the calls that were made to CacheWrap. Check the length with:

len(mockedMultiStore.CacheWrapCalls())

func (*MultiStoreMock) CacheWrapWithListeners

func (mock *MultiStoreMock) CacheWrapWithListeners(storeKey types.StoreKey, listeners []types.WriteListener) types.CacheWrap

CacheWrapWithListeners calls CacheWrapWithListenersFunc.

func (*MultiStoreMock) CacheWrapWithListenersCalls

func (mock *MultiStoreMock) CacheWrapWithListenersCalls() []struct {
	StoreKey  types.StoreKey
	Listeners []types.WriteListener
}

CacheWrapWithListenersCalls gets all the calls that were made to CacheWrapWithListeners. Check the length with:

len(mockedMultiStore.CacheWrapWithListenersCalls())

func (*MultiStoreMock) CacheWrapWithTrace

func (mock *MultiStoreMock) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap

CacheWrapWithTrace calls CacheWrapWithTraceFunc.

func (*MultiStoreMock) CacheWrapWithTraceCalls

func (mock *MultiStoreMock) CacheWrapWithTraceCalls() []struct {
	W  io.Writer
	Tc types.TraceContext
}

CacheWrapWithTraceCalls gets all the calls that were made to CacheWrapWithTrace. Check the length with:

len(mockedMultiStore.CacheWrapWithTraceCalls())

func (*MultiStoreMock) GetKVStore

func (mock *MultiStoreMock) GetKVStore(storeKey types.StoreKey) types.KVStore

GetKVStore calls GetKVStoreFunc.

func (*MultiStoreMock) GetKVStoreCalls

func (mock *MultiStoreMock) GetKVStoreCalls() []struct {
	StoreKey types.StoreKey
}

GetKVStoreCalls gets all the calls that were made to GetKVStore. Check the length with:

len(mockedMultiStore.GetKVStoreCalls())

func (*MultiStoreMock) GetStore

func (mock *MultiStoreMock) GetStore(storeKey types.StoreKey) types.Store

GetStore calls GetStoreFunc.

func (*MultiStoreMock) GetStoreCalls

func (mock *MultiStoreMock) GetStoreCalls() []struct {
	StoreKey types.StoreKey
}

GetStoreCalls gets all the calls that were made to GetStore. Check the length with:

len(mockedMultiStore.GetStoreCalls())

func (*MultiStoreMock) GetStoreType

func (mock *MultiStoreMock) GetStoreType() types.StoreType

GetStoreType calls GetStoreTypeFunc.

func (*MultiStoreMock) GetStoreTypeCalls

func (mock *MultiStoreMock) GetStoreTypeCalls() []struct {
}

GetStoreTypeCalls gets all the calls that were made to GetStoreType. Check the length with:

len(mockedMultiStore.GetStoreTypeCalls())

func (*MultiStoreMock) ListeningEnabled

func (mock *MultiStoreMock) ListeningEnabled(key types.StoreKey) bool

ListeningEnabled calls ListeningEnabledFunc.

func (*MultiStoreMock) ListeningEnabledCalls

func (mock *MultiStoreMock) ListeningEnabledCalls() []struct {
	Key types.StoreKey
}

ListeningEnabledCalls gets all the calls that were made to ListeningEnabled. Check the length with:

len(mockedMultiStore.ListeningEnabledCalls())

func (*MultiStoreMock) SetTracer

func (mock *MultiStoreMock) SetTracer(w io.Writer) types.MultiStore

SetTracer calls SetTracerFunc.

func (*MultiStoreMock) SetTracerCalls

func (mock *MultiStoreMock) SetTracerCalls() []struct {
	W io.Writer
}

SetTracerCalls gets all the calls that were made to SetTracer. Check the length with:

len(mockedMultiStore.SetTracerCalls())

func (*MultiStoreMock) SetTracingContext

func (mock *MultiStoreMock) SetTracingContext(traceContext types.TraceContext) types.MultiStore

SetTracingContext calls SetTracingContextFunc.

func (*MultiStoreMock) SetTracingContextCalls

func (mock *MultiStoreMock) SetTracingContextCalls() []struct {
	TraceContext types.TraceContext
}

SetTracingContextCalls gets all the calls that were made to SetTracingContext. Check the length with:

len(mockedMultiStore.SetTracingContextCalls())

func (*MultiStoreMock) TracingEnabled

func (mock *MultiStoreMock) TracingEnabled() bool

TracingEnabled calls TracingEnabledFunc.

func (*MultiStoreMock) TracingEnabledCalls

func (mock *MultiStoreMock) TracingEnabledCalls() []struct {
}

TracingEnabledCalls gets all the calls that were made to TracingEnabled. Check the length with:

len(mockedMultiStore.TracingEnabledCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL