Documentation
¶
Index ¶
- func CreateAuthContext(username, password string) context.Context
- func CreateOrgClient(t *testing.T, cfg *Config) *thehive.APIClient
- func DummyElicitationAccept(ctx context.Context, request mcp.ElicitationRequest) (*mcp.ElicitationResult, error)
- func DummySamplingHandlerCreateMessage(ctx context.Context, request mcp.CreateMessageRequest) (*mcp.CreateMessageResult, error)
- func GetAdminAuthContext(testConfig *HiveTestConfig) context.Context
- func GetAuthContext(testConfig *HiveTestConfig) context.Context
- func GetMCPTestClient(t *testing.T, ...) *client.Client
- func GetMCPTestClientWithPermissions(t *testing.T, ...) *client.Client
- func MockInputAlert() *thehive.InputCreateAlert
- func MockInputAnalyzerJob() *thehive.InputJob
- func MockInputCase() *thehive.InputCreateCase
- func MockInputCaseTemplate() *thehive.InputCreateCaseTemplate
- func MockInputObservable() *thehive.InputCreateObservable
- func MockInputOrganisation() *thehive.InputCreateOrganisation
- func MockInputTask() *thehive.InputCreateTask
- func MockInputUser() *thehive.InputCreateUser
- func MockInputUserOrganisation() []thehive.InputUserOrganisation
- func NewMCPTestConfig() *types.TheHiveMcpDefaultOptions
- func NewTestClient(t *testing.T) *thehive.APIClient
- func ResetHiveInstance(t *testing.T, hiveUrl string, testConfig *HiveTestConfig) error
- func SamplingHandlerCreateMessageFromStringResponse(response string) ...
- func SetupTestWithCleanup(t *testing.T) *thehive.APIClient
- func StartTheHiveContainer(t *testing.T) (string, error)
- type Config
- type HiveTestConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAuthContext ¶
CreateAuthContext creates an authentication context for API calls
func CreateOrgClient ¶
CreateOrgClient creates a client configured for a specific organisation
func DummyElicitationAccept ¶
func DummyElicitationAccept(ctx context.Context, request mcp.ElicitationRequest) (*mcp.ElicitationResult, error)
func DummySamplingHandlerCreateMessage ¶
func DummySamplingHandlerCreateMessage(ctx context.Context, request mcp.CreateMessageRequest) (*mcp.CreateMessageResult, error)
func GetAdminAuthContext ¶
func GetAdminAuthContext(testConfig *HiveTestConfig) context.Context
GetAdminAuthContext creates a context with admin authentication for API calls
func GetAuthContext ¶
func GetAuthContext(testConfig *HiveTestConfig) context.Context
GetAuthContext creates a context with authentication for API calls
func GetMCPTestClient ¶
func GetMCPTestClient( t *testing.T, samplingHandlerCreateMessage func(ctx context.Context, request mcp.CreateMessageRequest) (*mcp.CreateMessageResult, error), elicitationHandlerElicit func(ctx context.Context, request mcp.ElicitationRequest) (*mcp.ElicitationResult, error), ) *client.Client
func GetMCPTestClientWithPermissions ¶
func GetMCPTestClientWithPermissions( t *testing.T, samplingHandlerCreateMessage func(ctx context.Context, request mcp.CreateMessageRequest) (*mcp.CreateMessageResult, error), elicitationHandlerElicit func(ctx context.Context, request mcp.ElicitationRequest) (*mcp.ElicitationResult, error), permissionsConfigPath string, ) *client.Client
GetMCPTestClientWithPermissions creates a test client with specific permissions configuration permissionsConfigPath can be: - types.PermissionConfigAdmin for admin permissions - types.PermissionConfigReadOnly for read-only permissions - "docs/examples/permissions/analyst.yaml" for analyst permissions (file path) - "" for default read-only permissions (empty string)
func MockInputAlert ¶
func MockInputAlert() *thehive.InputCreateAlert
func MockInputAnalyzerJob ¶
MockInputAnalyzerJob returns a valid InputJob for testing Cortex analyzer functionality.
func MockInputCase ¶
func MockInputCase() *thehive.InputCreateCase
func MockInputCaseTemplate ¶
func MockInputCaseTemplate() *thehive.InputCreateCaseTemplate
MockInputCaseTemplate returns a valid InputCaseTemplate for testing.
func MockInputObservable ¶
func MockInputObservable() *thehive.InputCreateObservable
MockInputObservable returns a valid InputObservable for testing.
func MockInputOrganisation ¶
func MockInputOrganisation() *thehive.InputCreateOrganisation
func MockInputTask ¶
func MockInputTask() *thehive.InputCreateTask
MockInputTask returns a valid InputTask for testing.
func MockInputUser ¶
func MockInputUser() *thehive.InputCreateUser
func MockInputUserOrganisation ¶
func MockInputUserOrganisation() []thehive.InputUserOrganisation
func NewMCPTestConfig ¶
func NewMCPTestConfig() *types.TheHiveMcpDefaultOptions
func ResetHiveInstance ¶
func ResetHiveInstance(t *testing.T, hiveUrl string, testConfig *HiveTestConfig) error
ResetHiveInstance clears all data from the test organisations
func SamplingHandlerCreateMessageFromStringResponse ¶
func SamplingHandlerCreateMessageFromStringResponse(response string) func(ctx context.Context, request mcp.CreateMessageRequest) (*mcp.CreateMessageResult, error)
func SetupTestWithCleanup ¶
SetupTestWithCleanup creates a test client and registers automatic cleanup Call this at the beginning of each test function
Types ¶
type HiveTestConfig ¶
type HiveTestConfig struct {
ImageName string
ContainerName string
User string
Password string
MainOrg string
AdminOrg string
}
func NewHiveTestConfig ¶
func NewHiveTestConfig() *HiveTestConfig