Documentation ¶
Index ¶
- Variables
- func MockLagoonReset()
- func MockLagoonServer() *httptest.Server
- func MockRemoteInsightsServer(state *MockInsightsRemoteTestState) *httptest.Server
- func ShellCommanderMaker(out *string, err error, generatedCommand *string) func(name string, arg ...string) command.IShellCommand
- func TestFetchData(t *testing.T, ctest FetchDataTest)
- func TestRemediate(t *testing.T, rt RemediateTest)
- func TestRunCheck(t *testing.T, ctest RunCheckTest)
- type FetchDataTest
- type MockInsightsRemoteTestState
- type RemediateTest
- type RunCheckTest
- type TestShellCommand
Constants ¶
This section is empty.
Variables ¶
var MockLagoonNumCalls int
var MockLagoonRequestBodies []string
Functions ¶
func MockLagoonReset ¶ added in v0.2.2
func MockLagoonReset()
func MockLagoonServer ¶ added in v0.2.2
func MockRemoteInsightsServer ¶ added in v0.3.0
func MockRemoteInsightsServer(state *MockInsightsRemoteTestState) *httptest.Server
func ShellCommanderMaker ¶
func ShellCommanderMaker(out *string, err error, generatedCommand *string) func(name string, arg ...string) command.IShellCommand
ShellCommanderMaker is a commander generator that can return the provided stdout or stderr, and can also update a given variable with the generated command.
func TestFetchData ¶ added in v0.3.0
func TestFetchData(t *testing.T, ctest FetchDataTest)
TestFetchData can be used to run test scenarios in test tables.
func TestRemediate ¶ added in v0.3.0
func TestRemediate(t *testing.T, rt RemediateTest)
TestRunCheck can be used to run test scenarios in test tables.
func TestRunCheck ¶
func TestRunCheck(t *testing.T, ctest RunCheckTest)
TestRunCheck can be used to run test scenarios in test tables.
Types ¶
type FetchDataTest ¶ added in v0.3.0
type FetchDataTest struct { // Name of the test. Name string Check config.Check // Initialise the check before testing. Init bool // Func to run before running the check PreFetch func(t *testing.T) // Expected values after running the check. ExpectPasses []string ExpectBreaches []result.Breach ExpectDataMap map[string][]byte }
FetchDataTest can be used to create test scenarios using test tables, for the FetchData method using TestFetchData below.
type MockInsightsRemoteTestState ¶ added in v0.3.0
type RemediateTest ¶ added in v0.3.0
type RemediateTest struct { // Name of the test. Name string Check config.Check Breaches []result.Breach // Func to run before running Remediate PreRun func(t *testing.T) // Expected values after running Remediate. ExpectGeneratedCommand string ExpectStatusFail bool ExpectNoBreach bool ExpectBreaches []result.Breach ExpectRemediationStatus result.RemediationStatus ExpectNoRemediations bool ExpectRemediations []string }
CheckTest can be used to create test scenarios, especially using test tables, for the RunCheck method using TestRunCheck below.
type RunCheckTest ¶
type RunCheckTest struct { // Name of the test. Name string Check config.Check // Initialise the check before testing. Init bool // Sort the results after running the check. Sort bool // Func to run before running the check PreRun func(t *testing.T) // Expected values after running the check. ExpectStatus result.Status ExpectNoPass bool ExpectPasses []string ExpectNoFail bool ExpectFails []result.Breach }
CheckTest can be used to create test scenarios, especially using test tables, for the RunCheck method using TestRunCheck below.
type TestShellCommand ¶
func (TestShellCommand) Output ¶
func (sc TestShellCommand) Output() ([]byte, error)