Documentation ¶
Overview ¶
Package rpcmock contains RPC mocking utilities.
Index ¶
- type Handler
- type HandlerFunc
- type Mock
- func (i *Mock) AllWereMet() bool
- func (i *Mock) Expect() *RequestBuilder
- func (i *Mock) ExpectCall(body bin.Encoder) *RequestBuilder
- func (i *Mock) ExpectFunc(fn func(b bin.Encoder)) *RequestBuilder
- func (i *Mock) Handler() HandlerFunc
- func (i *Mock) InvokeRaw(ctx context.Context, input bin.Encoder, output bin.Decoder) error
- type RequestBuilder
- func (b *RequestBuilder) N(times int) *RequestBuilder
- func (b *RequestBuilder) ThenErr(err error) *Mock
- func (b *RequestBuilder) ThenFalse() *Mock
- func (b *RequestBuilder) ThenFlood(arg int) *Mock
- func (b *RequestBuilder) ThenMigrate(typ string, arg int) *Mock
- func (b *RequestBuilder) ThenRPCErr(err *tgerr.Error) *Mock
- func (b *RequestBuilder) ThenResult(body bin.Encoder) *Mock
- func (b *RequestBuilder) ThenTrue() *Mock
- func (b *RequestBuilder) ThenUnregistered() *Mock
- type TestingT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
HandlerFunc is a function adapter for Handler.
type Mock ¶
type Mock struct { *require.Assertions // contains filtered or unexported fields }
Mock is a mock tg.Invoker.
func NewMock ¶
func NewMock(testingT TestingT, assert *require.Assertions) *Mock
NewMock creates new Mock.
func (*Mock) AllWereMet ¶
AllWereMet returns true if all expected calls happened.
func (*Mock) Expect ¶
func (i *Mock) Expect() *RequestBuilder
Expect creates builder of new expected call.
func (*Mock) ExpectCall ¶
func (i *Mock) ExpectCall(body bin.Encoder) *RequestBuilder
ExpectCall creates builder of new expected call with given input.
func (*Mock) ExpectFunc ¶ added in v0.26.0
func (i *Mock) ExpectFunc(fn func(b bin.Encoder)) *RequestBuilder
ExpectFunc creates builder of new expected call with given input checker.
type RequestBuilder ¶
type RequestBuilder struct {
// contains filtered or unexported fields
}
RequestBuilder is builder of expected RPC request.
func (*RequestBuilder) N ¶
func (b *RequestBuilder) N(times int) *RequestBuilder
N sets count of expected calls.
func (*RequestBuilder) ThenErr ¶
func (b *RequestBuilder) ThenErr(err error) *Mock
ThenErr adds call result to the end of call stack.
func (*RequestBuilder) ThenFalse ¶ added in v0.26.0
func (b *RequestBuilder) ThenFalse() *Mock
ThenFalse adds call tg.BoolFalse result to the end of call stack.
func (*RequestBuilder) ThenFlood ¶
func (b *RequestBuilder) ThenFlood(arg int) *Mock
ThenFlood adds call result to the end of call stack.
func (*RequestBuilder) ThenMigrate ¶
func (b *RequestBuilder) ThenMigrate(typ string, arg int) *Mock
ThenMigrate adds call result to the end of call stack.
func (*RequestBuilder) ThenRPCErr ¶
func (b *RequestBuilder) ThenRPCErr(err *tgerr.Error) *Mock
ThenRPCErr adds call result to the end of call stack.
func (*RequestBuilder) ThenResult ¶
func (b *RequestBuilder) ThenResult(body bin.Encoder) *Mock
ThenResult adds call result to the end of call stack.
func (*RequestBuilder) ThenTrue ¶ added in v0.26.0
func (b *RequestBuilder) ThenTrue() *Mock
ThenTrue adds call tg.BoolTrue result to the end of call stack.
func (*RequestBuilder) ThenUnregistered ¶
func (b *RequestBuilder) ThenUnregistered() *Mock
ThenUnregistered adds call result to the end of call stack.