Documentation ¶
Index ¶
- func ContextWithLogger(t *testing.T) context.Context
- func ContextWithVerboseLogger(t *testing.T) context.Context
- type ErrorTransport
- type Response
- type ResponseDef
- func (r ResponseDef) Delete(t *testing.T, req *http.Request) Response
- func (r ResponseDef) Get(t *testing.T, req *http.Request) Response
- func (r ResponseDef) Post(t *testing.T, req *http.Request) Response
- func (r ResponseDef) Put(t *testing.T, req *http.Request) Response
- func (r ResponseDef) Validate(t *testing.T, req *http.Request)
- type TestServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorTransport ¶
type ErrorTransport struct{}
ErrorTransport is custom transport that always produces a simulated network error.
type ResponseDef ¶
type TestServer ¶
type TestServer struct { *httptest.Server // Embedded httptest.Server for underlying server functionality. // contains filtered or unexported fields }
TestServer is a wrapper around httptest.Server that provides utility methods for testing.
func NewHTTPTestServer ¶
func NewHTTPTestServer(t *testing.T, responses []ResponseDef) *TestServer
NewHTTPTestServer creates a new HTTP test server with the specified responses for each HTTP method.
func (TestServer) Calls ¶
func (t TestServer) Calls() int
Calls returns the number of calls invoked on the test server
func (TestServer) Client ¶
func (t TestServer) Client() *http.Client
Client returns an HTTP client associated with the test server.
func (TestServer) FaultyClient ¶
func (t TestServer) FaultyClient() *http.Client
FaultyClient returns an HTTP client associated with the test server that always produces a network error.
Click to show internal directories.
Click to hide internal directories.