Documentation
¶
Index ¶
- type MockHTTPClient
- func (m *MockHTTPClient) AssertNumberOfRequests(t testing.TB, expected int)
- func (m *MockHTTPClient) AssertRequestMade(t testing.TB, urlPattern string)
- func (m *MockHTTPClient) GetRequests() []RecordedRequest
- func (m *MockHTTPClient) GetRequestsTo(urlPattern string) []RecordedRequest
- func (m *MockHTTPClient) SetResponse(urlPattern string, response MockResponse)
- func (m *MockHTTPClient) SetResponseForRequest(method, urlPattern string, response MockResponse)
- type MockResponse
- type MockTransport
- type PostgreSQLContainer
- type RecordedRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockHTTPClient ¶
MockHTTPClient provides a way to mock HTTP responses for testing
func SetupMockHTTPClient ¶
func SetupMockHTTPClient(t testing.TB) *MockHTTPClient
SetupMockHTTPClient creates a new mock HTTP client for testing
func (*MockHTTPClient) AssertNumberOfRequests ¶
func (m *MockHTTPClient) AssertNumberOfRequests(t testing.TB, expected int)
AssertNumberOfRequests asserts the total number of requests made
func (*MockHTTPClient) AssertRequestMade ¶
func (m *MockHTTPClient) AssertRequestMade(t testing.TB, urlPattern string)
AssertRequestMade asserts that a request was made to the given URL
func (*MockHTTPClient) GetRequests ¶
func (m *MockHTTPClient) GetRequests() []RecordedRequest
GetRequests returns all recorded requests
func (*MockHTTPClient) GetRequestsTo ¶
func (m *MockHTTPClient) GetRequestsTo(urlPattern string) []RecordedRequest
GetRequestsTo returns all recorded requests to a specific URL pattern
func (*MockHTTPClient) SetResponse ¶
func (m *MockHTTPClient) SetResponse(urlPattern string, response MockResponse)
SetResponse configures a mock response for a specific URL pattern
func (*MockHTTPClient) SetResponseForRequest ¶
func (m *MockHTTPClient) SetResponseForRequest(method, urlPattern string, response MockResponse)
SetResponseForRequest configures a mock response for a specific method and URL
type MockResponse ¶
type MockResponse struct {
StatusCode int
Body interface{} // Will be JSON marshaled if not string/[]byte
Headers map[string]string
Error error
}
MockResponse defines a mocked HTTP response
type MockTransport ¶
type MockTransport struct {
// contains filtered or unexported fields
}
MockTransport implements http.RoundTripper for intercepting HTTP requests
type PostgreSQLContainer ¶ added in v1.1.0
type PostgreSQLContainer struct {
URL string
// contains filtered or unexported fields
}
func SetupPostgreSQLContainer ¶ added in v1.1.0
func SetupPostgreSQLContainer(t testing.TB) *PostgreSQLContainer