Documentation
¶
Overview ¶
Package httpmock provides functionalities for mocking the httpmock components.
Index ¶
- Variables
- type Expectation
- func (_m *Expectation) After(d time.Duration) httpmock.Expectation
- func (_m *Expectation) Handle(_a0 http.ResponseWriter, _a1 *http.Request, _a2 map[string]string) error
- func (_m *Expectation) Once() httpmock.Expectation
- func (_m *Expectation) Return(v interface{}) httpmock.Expectation
- func (_m *Expectation) ReturnCode(code int) httpmock.Expectation
- func (_m *Expectation) ReturnFile(filePath string) httpmock.Expectation
- func (_m *Expectation) ReturnHeader(header string, value string) httpmock.Expectation
- func (_m *Expectation) ReturnHeaders(headers map[string]string) httpmock.Expectation
- func (_m *Expectation) ReturnJSON(body interface{}) httpmock.Expectation
- func (_m *Expectation) Returnf(format string, args ...interface{}) httpmock.Expectation
- func (_m *Expectation) Run(handle func(*http.Request) ([]byte, error)) httpmock.Expectation
- func (_m *Expectation) Times(i uint) httpmock.Expectation
- func (_m *Expectation) Twice() httpmock.Expectation
- func (_m *Expectation) UnlimitedTimes() httpmock.Expectation
- func (_m *Expectation) WaitUntil(w <-chan time.Time) httpmock.Expectation
- func (_m *Expectation) WithBody(body interface{}) httpmock.Expectation
- func (_m *Expectation) WithBodyJSON(v interface{}) httpmock.Expectation
- func (_m *Expectation) WithBodyf(format string, args ...interface{}) httpmock.Expectation
- func (_m *Expectation) WithHeader(header string, value interface{}) httpmock.Expectation
- func (_m *Expectation) WithHeaders(headers map[string]interface{}) httpmock.Expectation
- type ExpectationMocker
Constants ¶
This section is empty.
Variables ¶
var NoMockExpectation = Mock()
NoMockExpectation is no mock Expectation.
Functions ¶
This section is empty.
Types ¶
type Expectation ¶
Expectation is an autogenerated mock type for the expectation type
func NewExpectation ¶
func NewExpectation(t mockConstructorTestingTNewExpectation) *Expectation
NewExpectation creates a new instance of Expectation. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*Expectation) After ¶
func (_m *Expectation) After(d time.Duration) httpmock.Expectation
After provides a mock function with given fields: d
func (*Expectation) Handle ¶
func (_m *Expectation) Handle(_a0 http.ResponseWriter, _a1 *http.Request, _a2 map[string]string) error
Handle provides a mock function with given fields: _a0, _a1, _a2
func (*Expectation) Once ¶
func (_m *Expectation) Once() httpmock.Expectation
Once provides a mock function with given fields:
func (*Expectation) Return ¶
func (_m *Expectation) Return(v interface{}) httpmock.Expectation
Return provides a mock function with given fields: v
func (*Expectation) ReturnCode ¶
func (_m *Expectation) ReturnCode(code int) httpmock.Expectation
ReturnCode provides a mock function with given fields: code
func (*Expectation) ReturnFile ¶
func (_m *Expectation) ReturnFile(filePath string) httpmock.Expectation
ReturnFile provides a mock function with given fields: filePath
func (*Expectation) ReturnHeader ¶
func (_m *Expectation) ReturnHeader(header string, value string) httpmock.Expectation
ReturnHeader provides a mock function with given fields: header, value
func (*Expectation) ReturnHeaders ¶
func (_m *Expectation) ReturnHeaders(headers map[string]string) httpmock.Expectation
ReturnHeaders provides a mock function with given fields: headers
func (*Expectation) ReturnJSON ¶
func (_m *Expectation) ReturnJSON(body interface{}) httpmock.Expectation
ReturnJSON provides a mock function with given fields: body
func (*Expectation) Returnf ¶
func (_m *Expectation) Returnf(format string, args ...interface{}) httpmock.Expectation
Returnf provides a mock function with given fields: format, args
func (*Expectation) Run ¶
func (_m *Expectation) Run(handle func(*http.Request) ([]byte, error)) httpmock.Expectation
Run provides a mock function with given fields: handle
func (*Expectation) Times ¶
func (_m *Expectation) Times(i uint) httpmock.Expectation
Times provides a mock function with given fields: i
func (*Expectation) Twice ¶
func (_m *Expectation) Twice() httpmock.Expectation
Twice provides a mock function with given fields:
func (*Expectation) UnlimitedTimes ¶
func (_m *Expectation) UnlimitedTimes() httpmock.Expectation
UnlimitedTimes provides a mock function with given fields:
func (*Expectation) WaitUntil ¶
func (_m *Expectation) WaitUntil(w <-chan time.Time) httpmock.Expectation
WaitUntil provides a mock function with given fields: w
func (*Expectation) WithBody ¶
func (_m *Expectation) WithBody(body interface{}) httpmock.Expectation
WithBody provides a mock function with given fields: body
func (*Expectation) WithBodyJSON ¶
func (_m *Expectation) WithBodyJSON(v interface{}) httpmock.Expectation
WithBodyJSON provides a mock function with given fields: v
func (*Expectation) WithBodyf ¶
func (_m *Expectation) WithBodyf(format string, args ...interface{}) httpmock.Expectation
WithBodyf provides a mock function with given fields: format, args
func (*Expectation) WithHeader ¶
func (_m *Expectation) WithHeader(header string, value interface{}) httpmock.Expectation
WithHeader provides a mock function with given fields: header, value
func (*Expectation) WithHeaders ¶
func (_m *Expectation) WithHeaders(headers map[string]interface{}) httpmock.Expectation
WithHeaders provides a mock function with given fields: headers
type ExpectationMocker ¶
type ExpectationMocker func(tb testing.TB) *Expectation
ExpectationMocker is Expectation mocker.
func Mock ¶
func Mock(mocks ...func(e *Expectation)) ExpectationMocker
Mock creates Expectation mock with cleanup to ensure all the expectations are met.