Documentation ¶
Index ¶
- Variables
- func WithSDK(t *testing.T, f func(*testing.T, *api.VK, *TestCase))
- type Expectation
- func (e *Expectation) Fails(fails bool) *Expectation
- func (e Expectation) Match(method string, params api.Params) (bool, api.Response, error)
- func (e *Expectation) Returns(response api.Response) *Expectation
- func (e *Expectation) ReturnsBytes(data []byte) *Expectation
- func (e *Expectation) ReturnsBytesF(f func() []byte) *Expectation
- func (e *Expectation) ReturnsF(f func() api.Response) *Expectation
- func (e *Expectation) ReturnsJSON(v interface{}) *Expectation
- func (e *Expectation) ReturnsJSONF(f func() interface{}) *Expectation
- func (e *Expectation) WithError(message string) *Expectation
- func (e *Expectation) WithParams(params api.Params) *Expectation
- func (e *Expectation) WithParamsF(f func() api.Params) *Expectation
- type Expectations
- type TestCase
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotExpected = fmt.Errorf("call is not expected")
Functions ¶
Types ¶
type Expectation ¶
type Expectation struct { Method string Params api.Params Response api.Response ErrorResponse bool ErrorMessage string }
func NewExpectation ¶
func NewExpectation(method string) *Expectation
func (*Expectation) Fails ¶
func (e *Expectation) Fails(fails bool) *Expectation
func (*Expectation) Returns ¶
func (e *Expectation) Returns(response api.Response) *Expectation
func (*Expectation) ReturnsBytes ¶
func (e *Expectation) ReturnsBytes(data []byte) *Expectation
func (*Expectation) ReturnsBytesF ¶
func (e *Expectation) ReturnsBytesF(f func() []byte) *Expectation
func (*Expectation) ReturnsF ¶
func (e *Expectation) ReturnsF(f func() api.Response) *Expectation
func (*Expectation) ReturnsJSON ¶
func (e *Expectation) ReturnsJSON(v interface{}) *Expectation
func (*Expectation) ReturnsJSONF ¶
func (e *Expectation) ReturnsJSONF(f func() interface{}) *Expectation
func (*Expectation) WithError ¶
func (e *Expectation) WithError(message string) *Expectation
func (*Expectation) WithParams ¶
func (e *Expectation) WithParams(params api.Params) *Expectation
func (*Expectation) WithParamsF ¶
func (e *Expectation) WithParamsF(f func() api.Params) *Expectation
type Expectations ¶
type Expectations []*Expectation
func (*Expectations) Pop ¶
func (stack *Expectations) Pop() (result *Expectation, ok bool)
func (*Expectations) Push ¶
func (stack *Expectations) Push(element *Expectation)
type TestCase ¶
type TestCase struct { Expectations Expectations T *testing.T }
func NewTestCase ¶
func (*TestCase) ExpectCall ¶
func (test *TestCase) ExpectCall(method string) *Expectation
func (*TestCase) ExpectationsWereMet ¶
Click to show internal directories.
Click to hide internal directories.