Documentation
¶
Index ¶
- func AssertEqual(t *testing.T, expected, actual interface{})
- func AssertError(t *testing.T, err error)
- func AssertErrorContains(t *testing.T, err error, expected string)
- func AssertNoError(t *testing.T, err error)
- func AssertNotNil(t *testing.T, value interface{})
- func Contains(s, substr string) bool
- func CreateTestCache() *sync.Map
- func CreateTestContext() context.Context
- func CreateTestLogger() *logrus.Logger
- type MockCache
- type MockHTTPClient
- type MockHTTPResponse
- type MockReadCloser
- type MockTool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEqual ¶
AssertEqual fails the test if expected != actual
func AssertError ¶
AssertError fails the test if err is nil
func AssertErrorContains ¶
AssertErrorContains fails the test if err is nil or doesn't contain the expected message
func AssertNoError ¶
AssertNoError fails the test if err is not nil
func AssertNotNil ¶
AssertNotNil fails the test if value is nil
func CreateTestCache ¶
CreateTestCache creates a cache suitable for testing
func CreateTestContext ¶
CreateTestContext creates a context suitable for testing
func CreateTestLogger ¶
CreateTestLogger creates a logger suitable for testing
Types ¶
type MockCache ¶
type MockCache struct {
// contains filtered or unexported fields
}
MockCache provides a controllable cache for testing
func (*MockCache) Delete ¶
func (m *MockCache) Delete(key interface{})
Delete removes a value from the mock cache
type MockHTTPClient ¶
type MockHTTPClient struct {
// contains filtered or unexported fields
}
MockHTTPClient for testing HTTP-based tools
func NewMockHTTPClient ¶
func NewMockHTTPClient() *MockHTTPClient
NewMockHTTPClient creates a new mock HTTP client
func (*MockHTTPClient) Get ¶
func (m *MockHTTPClient) Get(url string) (*http.Response, error)
Get simulates an HTTP GET request (implements shadcnui.HTTPClient interface)
func (*MockHTTPClient) WithError ¶
func (m *MockHTTPClient) WithError(err error) *MockHTTPClient
WithError configures the mock to return an error
func (*MockHTTPClient) WithResponse ¶
func (m *MockHTTPClient) WithResponse(url string, statusCode int, body string) *MockHTTPClient
WithResponse configures a response for a specific URL
type MockHTTPResponse ¶
MockHTTPResponse simulates an HTTP response
type MockReadCloser ¶
type MockReadCloser struct {
// contains filtered or unexported fields
}
MockReadCloser implements io.ReadCloser for mock responses
type MockTool ¶
type MockTool struct {
// contains filtered or unexported fields
}
MockTool implements the Tool interface for testing
func (*MockTool) Definition ¶
Definition returns the tool's definition for MCP registration
func (*MockTool) Execute ¶
func (m *MockTool) Execute(ctx context.Context, logger *logrus.Logger, cache *sync.Map, args map[string]interface{}) (*mcp.CallToolResult, error)
Execute executes the mock tool
func (*MockTool) WithResult ¶
func (m *MockTool) WithResult(result *mcp.CallToolResult) *MockTool
WithResult configures the mock to return a specific result