Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrDeliberate occurs when a unit test simulates an error. ErrDeliberate = errors.New("deliberate error occurred") )
Functions ¶
This section is empty.
Types ¶
type HTTPClientMock ¶
type HTTPClientMock struct {
// contains filtered or unexported fields
}
HTTPClientMock represents a mocked HTTP client.
func NewHTTPClientMock ¶
func NewHTTPClientMock(options ...Option) *HTTPClientMock
NewHTTPClientMock creates a new instance of a mocked HTTP client.
func (*HTTPClientMock) Count ¶
func (h *HTTPClientMock) Count(path string) int
Count returns number of times the specified path was hit.
func (*HTTPClientMock) SetResponse ¶
func (h *HTTPClientMock) SetResponse(path string, response *http.Response)
SetResponse sets the response you expect to be returned from the server once the specified path is hit.
type Option ¶
type Option func(*Options)
Option represents an optional configuration function for mocked clients.
func ForceToFail ¶
ForceToFail if enabled, it forces the mocked HTTP requests to fail.
func WhenCalled ¶
WhenCalled sets a callback which will be called once an HTTP request is being sent to the server.
Click to show internal directories.
Click to hide internal directories.