mock

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMockMarshalizer = errors.New("MarshalizerMock generic error")

ErrMockMarshalizer -

View Source
var ErrNilObjectToMarshal = errors.New("nil object to serialize from")

ErrNilObjectToMarshal -

Functions

This section is empty.

Types

type AlarmSchedulerStub

type AlarmSchedulerStub struct {
	AddCalled    func(func(alarmID string), time.Duration, string)
	CancelCalled func(string)
	CloseCalled  func()
	ResetCalled  func(string)
}

AlarmSchedulerStub -

func (*AlarmSchedulerStub) Add

func (a *AlarmSchedulerStub) Add(callback func(alarmID string), duration time.Duration, alarmID string)

Add -

func (*AlarmSchedulerStub) Cancel

func (a *AlarmSchedulerStub) Cancel(alarmID string)

Cancel -

func (*AlarmSchedulerStub) Close

func (a *AlarmSchedulerStub) Close()

Close -

func (*AlarmSchedulerStub) IsInterfaceNil

func (a *AlarmSchedulerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*AlarmSchedulerStub) Reset

func (a *AlarmSchedulerStub) Reset(alarmID string)

Reset -

type AppStatusHandlerStub

type AppStatusHandlerStub struct {
	AddUint64Handler      func(key string, value uint64)
	IncrementHandler      func(key string)
	DecrementHandler      func(key string)
	SetUInt64ValueHandler func(key string, value uint64)
	SetInt64ValueHandler  func(key string, value int64)
	SetStringValueHandler func(key string, value string)
	CloseHandler          func()
}

AppStatusHandlerStub is a stub implementation of AppStatusHandler

func (*AppStatusHandlerStub) AddUint64

func (ashs *AppStatusHandlerStub) AddUint64(key string, value uint64)

AddUint64 will call the handler of the stub for incrementing

func (*AppStatusHandlerStub) Close

func (ashs *AppStatusHandlerStub) Close()

Close will call the handler of the stub for closing

func (*AppStatusHandlerStub) Decrement

func (ashs *AppStatusHandlerStub) Decrement(key string)

Decrement will call the handler of the stub for decrementing

func (*AppStatusHandlerStub) Increment

func (ashs *AppStatusHandlerStub) Increment(key string)

Increment will call the handler of the stub for incrementing

func (*AppStatusHandlerStub) IsInterfaceNil

func (ashs *AppStatusHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*AppStatusHandlerStub) SetInt64Value

func (ashs *AppStatusHandlerStub) SetInt64Value(key string, value int64)

SetInt64Value will call the handler of the stub for setting an int64 value

func (*AppStatusHandlerStub) SetStringValue

func (ashs *AppStatusHandlerStub) SetStringValue(key string, value string)

SetStringValue will call the handler of the stub for setting an string value

func (*AppStatusHandlerStub) SetUInt64Value

func (ashs *AppStatusHandlerStub) SetUInt64Value(key string, value uint64)

SetUInt64Value will call the handler of the stub for setting an uint64 value

type ConnectedAddressesMock

type ConnectedAddressesMock struct {
}

ConnectedAddressesMock represents a mock implementation of the ConnectedAddresses

func (*ConnectedAddressesMock) ConnectedAddresses

func (cam *ConnectedAddressesMock) ConnectedAddresses() []string

ConnectedAddresses returns an empty slice of string

type EnableEpochsHandlerStub added in v0.1.0

type EnableEpochsHandlerStub struct {
	IsAutoBalanceDataTriesEnabledCalled func() bool
}

EnableEpochsHandlerStub -

func (*EnableEpochsHandlerStub) IsAutoBalanceDataTriesEnabled added in v0.1.0

func (e *EnableEpochsHandlerStub) IsAutoBalanceDataTriesEnabled() bool

IsAutoBalanceDataTriesEnabled -

func (*EnableEpochsHandlerStub) IsInterfaceNil added in v0.1.0

func (e *EnableEpochsHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type EpochSubscriberHandlerStub

type EpochSubscriberHandlerStub struct {
	EpochConfirmedCalled func(epoch uint32, timestamp uint64)
}

EpochSubscriberHandlerStub -

func (*EpochSubscriberHandlerStub) EpochConfirmed

func (eshs *EpochSubscriberHandlerStub) EpochConfirmed(epoch uint32, timestamp uint64)

EpochConfirmed -

func (*EpochSubscriberHandlerStub) IsInterfaceNil

func (eshs *EpochSubscriberHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

type GasScheduleSubscribeHandlerStub

type GasScheduleSubscribeHandlerStub struct {
	GasScheduleChangeCalled func(gasSchedule map[string]map[string]uint64)
}

GasScheduleSubscribeHandlerStub -

func (*GasScheduleSubscribeHandlerStub) GasScheduleChange

func (g *GasScheduleSubscribeHandlerStub) GasScheduleChange(gasSchedule map[string]map[string]uint64)

GasScheduleChange -

func (*GasScheduleSubscribeHandlerStub) IsInterfaceNil

func (g *GasScheduleSubscribeHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

type HasherMock

type HasherMock struct {
}

HasherMock that will be used for testing

func (HasherMock) Compute

func (sha HasherMock) Compute(s string) []byte

Compute will output the SHA's equivalent of the input string

func (HasherMock) EmptyHash

func (sha HasherMock) EmptyHash() []byte

EmptyHash will return the equivalent of empty string SHA's

func (HasherMock) IsInterfaceNil

func (sha HasherMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (HasherMock) Size

func (HasherMock) Size() int

Size returns the required size in bytes

type HasherStub

type HasherStub struct {
	ComputeCalled   func(s string) []byte
	EmptyHashCalled func() []byte
	SizeCalled      func() int
}

HasherStub -

func (*HasherStub) Compute

func (hash *HasherStub) Compute(s string) []byte

Compute -

func (*HasherStub) EmptyHash

func (hash *HasherStub) EmptyHash() []byte

EmptyHash -

func (*HasherStub) IsInterfaceNil

func (hash *HasherStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*HasherStub) Size

func (hash *HasherStub) Size() int

Size -

type IntRandomizerStub

type IntRandomizerStub struct {
	IntnCalled func(n int) int
}

IntRandomizerStub -

func (*IntRandomizerStub) Intn

func (irs *IntRandomizerStub) Intn(n int) int

Intn -

func (*IntRandomizerStub) IsInterfaceNil

func (irs *IntRandomizerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type LoggerMock

type LoggerMock struct {
}

LoggerMock -

func (LoggerMock) Debug

func (c LoggerMock) Debug(message string, args ...interface{})

Debug will print a debug log

func (LoggerMock) Error

func (c LoggerMock) Error(message string, args ...interface{})

Error will print an error log

func (LoggerMock) Info

func (c LoggerMock) Info(message string, args ...interface{})

Info will print an info log

func (LoggerMock) IsInterfaceNil

func (c LoggerMock) IsInterfaceNil() bool

IsInterfaceNil returns false as the struct doesn't use pointer receivers

func (LoggerMock) LogIfError

func (c LoggerMock) LogIfError(err error, args ...interface{})

LogIfError will print an error if it is not nil

func (LoggerMock) Trace

func (c LoggerMock) Trace(message string, args ...interface{})

Trace will print a trace log

func (LoggerMock) Warn

func (c LoggerMock) Warn(message string, args ...interface{})

Warn will print a warn log

type MarshalizerMock

type MarshalizerMock struct {
	Fail bool
}

MarshalizerMock that will be used for testing

func (*MarshalizerMock) IsInterfaceNil

func (mm *MarshalizerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MarshalizerMock) Marshal

func (mm *MarshalizerMock) Marshal(obj interface{}) ([]byte, error)

Marshal converts the input object in a slice of bytes

func (*MarshalizerMock) Unmarshal

func (mm *MarshalizerMock) Unmarshal(obj interface{}, buff []byte) error

Unmarshal applies the serialized values over an instantiated object

type MarshalizerStub

type MarshalizerStub struct {
	MarshalCalled   func(obj interface{}) ([]byte, error)
	UnmarshalCalled func(obj interface{}, buff []byte) error
}

MarshalizerStub -

func (*MarshalizerStub) IsInterfaceNil

func (ms *MarshalizerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*MarshalizerStub) Marshal

func (ms *MarshalizerStub) Marshal(obj interface{}) ([]byte, error)

Marshal -

func (*MarshalizerStub) Unmarshal

func (ms *MarshalizerStub) Unmarshal(obj interface{}, buff []byte) error

Unmarshal -

type PathManagerStub

type PathManagerStub struct {
	PathForEpochCalled  func(shardId string, epoch uint32, identifier string) string
	PathForStaticCalled func(shardId string, identifier string) string
	DatabasePathCalled  func() string
}

PathManagerStub -

func (*PathManagerStub) DatabasePath

func (p *PathManagerStub) DatabasePath() string

DatabasePath -

func (*PathManagerStub) IsInterfaceNil

func (p *PathManagerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*PathManagerStub) PathForEpoch

func (p *PathManagerStub) PathForEpoch(shardId string, epoch uint32, identifier string) string

PathForEpoch -

func (*PathManagerStub) PathForStatic

func (p *PathManagerStub) PathForStatic(shardId string, identifier string) string

PathForStatic -

type StableTagProviderStub

type StableTagProviderStub struct {
	FetchTagVersionCalled func() (string, error)
}

StableTagProviderStub --

func (*StableTagProviderStub) FetchTagVersion

func (s *StableTagProviderStub) FetchTagVersion() (string, error)

FetchTagVersion --

func (*StableTagProviderStub) IsInterfaceNil

func (s *StableTagProviderStub) IsInterfaceNil() bool

IsInterfaceNil --

type StatusHandlerMock

type StatusHandlerMock struct {
}

StatusHandlerMock -

func (*StatusHandlerMock) AddUint64

func (s *StatusHandlerMock) AddUint64(_ string, _ uint64)

AddUint64 -

func (*StatusHandlerMock) Close

func (s *StatusHandlerMock) Close()

Close -

func (*StatusHandlerMock) Decrement

func (s *StatusHandlerMock) Decrement(_ string)

Decrement -

func (*StatusHandlerMock) Increment

func (s *StatusHandlerMock) Increment(_ string)

Increment -

func (*StatusHandlerMock) IsInterfaceNil

func (s *StatusHandlerMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*StatusHandlerMock) SetInt64Value

func (s *StatusHandlerMock) SetInt64Value(_ string, _ int64)

SetInt64Value -

func (*StatusHandlerMock) SetStringValue

func (s *StatusHandlerMock) SetStringValue(_ string, _ string)

SetStringValue -

func (*StatusHandlerMock) SetUInt64Value

func (s *StatusHandlerMock) SetUInt64Value(_ string, _ uint64)

SetUInt64Value -

Jump to

Keyboard shortcuts

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