Documentation
¶
Overview ¶
Package testutil provides testing utilities and mock implementations for the Boomi SDK.
Index ¶
- func NewTestClient(baseURL string) *client.Client
- type AssertRequest
- type MockAuth
- type MockServer
- func (ms *MockServer) BaseURL() string
- func (ms *MockServer) Close()
- func (ms *MockServer) On(method, path string, handler http.HandlerFunc)
- func (ms *MockServer) OnError(method, path string, statusCode int, message string)
- func (ms *MockServer) OnGet(path string, response interface{})
- func (ms *MockServer) OnPost(path string, response interface{})
- func (ms *MockServer) URL() string
- type RequestCapture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestClient ¶
NewTestClient creates a new test client with the given base URL.
Types ¶
type AssertRequest ¶
type AssertRequest struct {
Method string
Path string
Body interface{}
Headers map[string]string
QueryParams map[string]string
}
AssertRequest provides utilities for asserting HTTP requests.
type MockAuth ¶
type MockAuth struct{}
MockAuth is a mock authenticator for testing.
func (*MockAuth) Authenticate ¶
Authenticate implements the Authenticator interface.
type MockServer ¶
type MockServer struct {
// contains filtered or unexported fields
}
MockServer provides a mock HTTP server for testing.
func (*MockServer) BaseURL ¶
func (ms *MockServer) BaseURL() string
URL returns the mock server's base URL for creating clients.
func (*MockServer) On ¶
func (ms *MockServer) On(method, path string, handler http.HandlerFunc)
On registers a handler for a specific method and path.
func (*MockServer) OnError ¶
func (ms *MockServer) OnError(method, path string, statusCode int, message string)
OnError registers an error handler.
func (*MockServer) OnGet ¶
func (ms *MockServer) OnGet(path string, response interface{})
OnGet registers a GET handler.
func (*MockServer) OnPost ¶
func (ms *MockServer) OnPost(path string, response interface{})
OnPost registers a POST handler.
type RequestCapture ¶
RequestCapture captures HTTP requests for testing.
func NewRequestCapture ¶
func NewRequestCapture() *RequestCapture
NewRequestCapture creates a new request capture.
func (*RequestCapture) CaptureHandler ¶
func (rc *RequestCapture) CaptureHandler(next http.HandlerFunc) http.HandlerFunc
CaptureHandler returns an HTTP handler that captures requests.
func (*RequestCapture) LastBody ¶
func (rc *RequestCapture) LastBody() []byte
LastBody returns the last captured request body.
func (*RequestCapture) LastRequest ¶
func (rc *RequestCapture) LastRequest() *http.Request
LastRequest returns the last captured request.
func (*RequestCapture) Reset ¶
func (rc *RequestCapture) Reset()
Reset clears all captured requests.