mocks

package
v0.0.0-...-f105c97 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheBustTagsFunc

type CacheBustTagsFunc struct {
	// contains filtered or unexported fields
}

CacheBustTagsFunc describes the behavior when the BustTags method of the parent MockCache instance is invoked.

func (*CacheBustTagsFunc) History

History returns a sequence of CacheBustTagsFuncCall objects describing the invocations of this function.

func (*CacheBustTagsFunc) PushHook

func (f *CacheBustTagsFunc) PushHook(hook func(...string) error)

PushHook adds a function to the end of hook queue. Each invocation of the BustTags method of the parent MockCache instance invokes the hook at the front of the queue and discards it. After the queue is empty, the default hook function is invoked for any future action.

func (*CacheBustTagsFunc) PushReturn

func (f *CacheBustTagsFunc) PushReturn(r0 error)

PushReturn calls PushDefaultHook with a function that returns the given values.

func (*CacheBustTagsFunc) SetDefaultHook

func (f *CacheBustTagsFunc) SetDefaultHook(hook func(...string) error)

SetDefaultHook sets function that is called when the BustTags method of the parent MockCache instance is invoked and the hook queue is empty.

func (*CacheBustTagsFunc) SetDefaultReturn

func (f *CacheBustTagsFunc) SetDefaultReturn(r0 error)

SetDefaultReturn calls SetDefaultDefaultHook with a function that returns the given values.

type CacheBustTagsFuncCall

type CacheBustTagsFuncCall struct {
	// Arg0 is a slice containing the values of the variadic arguments
	// passed to this method invocation.
	Arg0 []string
	// Result0 is the value of the 1st result returned from this method
	// invocation.
	Result0 error
}

CacheBustTagsFuncCall is an object that describes an invocation of method BustTags on an instance of MockCache.

func (CacheBustTagsFuncCall) Args

func (c CacheBustTagsFuncCall) Args() []interface{}

Args returns an interface slice containing the arguments of this invocation. The variadic slice argument is flattened in this array such that one positional argument and three variadic arguments would result in a slice of four, not two.

func (CacheBustTagsFuncCall) Results

func (c CacheBustTagsFuncCall) Results() []interface{}

Results returns an interface slice containing the results of this invocation.

type CacheGetValueFunc

type CacheGetValueFunc struct {
	// contains filtered or unexported fields
}

CacheGetValueFunc describes the behavior when the GetValue method of the parent MockCache instance is invoked.

func (*CacheGetValueFunc) History

History returns a sequence of CacheGetValueFuncCall objects describing the invocations of this function.

func (*CacheGetValueFunc) PushHook

func (f *CacheGetValueFunc) PushHook(hook func(string) (string, error))

PushHook adds a function to the end of hook queue. Each invocation of the GetValue method of the parent MockCache instance invokes the hook at the front of the queue and discards it. After the queue is empty, the default hook function is invoked for any future action.

func (*CacheGetValueFunc) PushReturn

func (f *CacheGetValueFunc) PushReturn(r0 string, r1 error)

PushReturn calls PushDefaultHook with a function that returns the given values.

func (*CacheGetValueFunc) SetDefaultHook

func (f *CacheGetValueFunc) SetDefaultHook(hook func(string) (string, error))

SetDefaultHook sets function that is called when the GetValue method of the parent MockCache instance is invoked and the hook queue is empty.

func (*CacheGetValueFunc) SetDefaultReturn

func (f *CacheGetValueFunc) SetDefaultReturn(r0 string, r1 error)

SetDefaultReturn calls SetDefaultDefaultHook with a function that returns the given values.

type CacheGetValueFuncCall

type CacheGetValueFuncCall struct {
	// Arg0 is the value of the 1st argument passed to this method
	// invocation.
	Arg0 string
	// Result0 is the value of the 1st result returned from this method
	// invocation.
	Result0 string
	// Result1 is the value of the 2nd result returned from this method
	// invocation.
	Result1 error
}

CacheGetValueFuncCall is an object that describes an invocation of method GetValue on an instance of MockCache.

func (CacheGetValueFuncCall) Args

func (c CacheGetValueFuncCall) Args() []interface{}

Args returns an interface slice containing the arguments of this invocation.

func (CacheGetValueFuncCall) Results

func (c CacheGetValueFuncCall) Results() []interface{}

Results returns an interface slice containing the results of this invocation.

type CacheRemoveFunc

type CacheRemoveFunc struct {
	// contains filtered or unexported fields
}

CacheRemoveFunc describes the behavior when the Remove method of the parent MockCache instance is invoked.

func (*CacheRemoveFunc) History

func (f *CacheRemoveFunc) History() []CacheRemoveFuncCall

History returns a sequence of CacheRemoveFuncCall objects describing the invocations of this function.

func (*CacheRemoveFunc) PushHook

func (f *CacheRemoveFunc) PushHook(hook func(string) error)

PushHook adds a function to the end of hook queue. Each invocation of the Remove method of the parent MockCache instance invokes the hook at the front of the queue and discards it. After the queue is empty, the default hook function is invoked for any future action.

func (*CacheRemoveFunc) PushReturn

func (f *CacheRemoveFunc) PushReturn(r0 error)

PushReturn calls PushDefaultHook with a function that returns the given values.

func (*CacheRemoveFunc) SetDefaultHook

func (f *CacheRemoveFunc) SetDefaultHook(hook func(string) error)

SetDefaultHook sets function that is called when the Remove method of the parent MockCache instance is invoked and the hook queue is empty.

func (*CacheRemoveFunc) SetDefaultReturn

func (f *CacheRemoveFunc) SetDefaultReturn(r0 error)

SetDefaultReturn calls SetDefaultDefaultHook with a function that returns the given values.

type CacheRemoveFuncCall

type CacheRemoveFuncCall struct {
	// Arg0 is the value of the 1st argument passed to this method
	// invocation.
	Arg0 string
	// Result0 is the value of the 1st result returned from this method
	// invocation.
	Result0 error
}

CacheRemoveFuncCall is an object that describes an invocation of method Remove on an instance of MockCache.

func (CacheRemoveFuncCall) Args

func (c CacheRemoveFuncCall) Args() []interface{}

Args returns an interface slice containing the arguments of this invocation.

func (CacheRemoveFuncCall) Results

func (c CacheRemoveFuncCall) Results() []interface{}

Results returns an interface slice containing the results of this invocation.

type CacheSetValueFunc

type CacheSetValueFunc struct {
	// contains filtered or unexported fields
}

CacheSetValueFunc describes the behavior when the SetValue method of the parent MockCache instance is invoked.

func (*CacheSetValueFunc) History

History returns a sequence of CacheSetValueFuncCall objects describing the invocations of this function.

func (*CacheSetValueFunc) PushHook

func (f *CacheSetValueFunc) PushHook(hook func(string, string, ...string) error)

PushHook adds a function to the end of hook queue. Each invocation of the SetValue method of the parent MockCache instance invokes the hook at the front of the queue and discards it. After the queue is empty, the default hook function is invoked for any future action.

func (*CacheSetValueFunc) PushReturn

func (f *CacheSetValueFunc) PushReturn(r0 error)

PushReturn calls PushDefaultHook with a function that returns the given values.

func (*CacheSetValueFunc) SetDefaultHook

func (f *CacheSetValueFunc) SetDefaultHook(hook func(string, string, ...string) error)

SetDefaultHook sets function that is called when the SetValue method of the parent MockCache instance is invoked and the hook queue is empty.

func (*CacheSetValueFunc) SetDefaultReturn

func (f *CacheSetValueFunc) SetDefaultReturn(r0 error)

SetDefaultReturn calls SetDefaultDefaultHook with a function that returns the given values.

type CacheSetValueFuncCall

type CacheSetValueFuncCall struct {
	// Arg0 is the value of the 1st argument passed to this method
	// invocation.
	Arg0 string
	// Arg1 is the value of the 2nd argument passed to this method
	// invocation.
	Arg1 string
	// Arg2 is a slice containing the values of the variadic arguments
	// passed to this method invocation.
	Arg2 []string
	// Result0 is the value of the 1st result returned from this method
	// invocation.
	Result0 error
}

CacheSetValueFuncCall is an object that describes an invocation of method SetValue on an instance of MockCache.

func (CacheSetValueFuncCall) Args

func (c CacheSetValueFuncCall) Args() []interface{}

Args returns an interface slice containing the arguments of this invocation. The variadic slice argument is flattened in this array such that one positional argument and three variadic arguments would result in a slice of four, not two.

func (CacheSetValueFuncCall) Results

func (c CacheSetValueFuncCall) Results() []interface{}

Results returns an interface slice containing the results of this invocation.

type MockCache

type MockCache struct {
	// BustTagsFunc is an instance of a mock function object controlling the
	// behavior of the method BustTags.
	BustTagsFunc *CacheBustTagsFunc
	// GetValueFunc is an instance of a mock function object controlling the
	// behavior of the method GetValue.
	GetValueFunc *CacheGetValueFunc
	// RemoveFunc is an instance of a mock function object controlling the
	// behavior of the method Remove.
	RemoveFunc *CacheRemoveFunc
	// SetValueFunc is an instance of a mock function object controlling the
	// behavior of the method SetValue.
	SetValueFunc *CacheSetValueFunc
}

MockCache is a mock implementation of the Cache interface (from the package github.com/efritz/gache) used for unit testing.

func NewMockCache

func NewMockCache() *MockCache

NewMockCache creates a new mock of the Cache interface. All methods return zero values for all results, unless overwritten.

func NewMockCacheFrom

func NewMockCacheFrom(i gache.Cache) *MockCache

NewMockCacheFrom creates a new mock of the MockCache interface. All methods delegate to the given implementation, unless overwritten.

func (*MockCache) BustTags

func (m *MockCache) BustTags(v0 ...string) error

BustTags delegates to the next hook function in the queue and stores the parameter and result values of this invocation.

func (*MockCache) GetValue

func (m *MockCache) GetValue(v0 string) (string, error)

GetValue delegates to the next hook function in the queue and stores the parameter and result values of this invocation.

func (*MockCache) Remove

func (m *MockCache) Remove(v0 string) error

Remove delegates to the next hook function in the queue and stores the parameter and result values of this invocation.

func (*MockCache) SetValue

func (m *MockCache) SetValue(v0 string, v1 string, v2 ...string) error

SetValue delegates to the next hook function in the queue and stores the parameter and result values of this invocation.

Jump to

Keyboard shortcuts

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