Documentation
¶
Index ¶
- func CaptureOutput(f func()) string
- func CreateTestClient() *client.Client
- func MockDatadogContext() context.Context
- func NewMockAPIResponseServer(responses map[string]MockAPIResponse) *httptest.Server
- func NewMockAPIServer(response any, statusCode int) *httptest.Server
- func NewMockAPIServerWithHandler(handler http.HandlerFunc) *httptest.Server
- func NewMockClient(serverURL string) *client.Client
- func SimulateInput(input string) io.Reader
- type MockAPIResponse
- type MockClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureOutput ¶
func CaptureOutput(f func()) string
CaptureOutput captures stdout during function execution
func CreateTestClient ¶
CreateTestClient creates a minimal test client for unit tests
func MockDatadogContext ¶
MockDatadogContext creates a test context for Datadog API calls
func NewMockAPIResponseServer ¶
func NewMockAPIResponseServer(responses map[string]MockAPIResponse) *httptest.Server
NewMockAPIResponseServer creates a server with multiple endpoint responses
func NewMockAPIServer ¶
NewMockAPIServer creates a mock HTTP server that returns the specified response
func NewMockAPIServerWithHandler ¶
func NewMockAPIServerWithHandler(handler http.HandlerFunc) *httptest.Server
NewMockAPIServerWithHandler creates a mock HTTP server with a custom handler
func NewMockClient ¶
NewMockClient creates a mock client that uses a test HTTP server
func SimulateInput ¶
SimulateInput creates an io.Reader from a string for simulating stdin
Types ¶
type MockAPIResponse ¶
MockAPIResponse represents a mock API response for testing
type MockClient ¶
MockClient provides a mock Datadog client for testing