Added test + misc

This commit is contained in:
Ice3man543 2021-11-05 16:59:24 +05:30
parent 8ad3ebcd05
commit 0a09b9e451

View File

@ -15,7 +15,9 @@ func TestSSLProtocol(t *testing.T) {
testutils.Init(options) testutils.Init(options)
templateID := "testing-ssl" templateID := "testing-ssl"
request := &Request{} request := &Request{
Address: "{{Hostname}}",
}
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{ executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{
ID: templateID, ID: templateID,
Info: model.Info{SeverityHolder: severity.Holder{Severity: severity.Low}, Name: "test"}, Info: model.Info{SeverityHolder: severity.Holder{Severity: severity.Low}, Name: "test"},
@ -23,8 +25,12 @@ func TestSSLProtocol(t *testing.T) {
err := request.Compile(executerOpts) err := request.Compile(executerOpts)
require.Nil(t, err, "could not compile ssl request") require.Nil(t, err, "could not compile ssl request")
err = request.ExecuteWithResults("google.com:443", nil, nil, func(event *output.InternalWrappedEvent) {}) var gotEvent output.InternalEvent
err = request.ExecuteWithResults("google.com:443", nil, nil, func(event *output.InternalWrappedEvent) {
gotEvent = event.InternalEvent
})
require.Nil(t, err, "could not run ssl request") require.Nil(t, err, "could not run ssl request")
require.NotEmpty(t, gotEvent, "could not get event items")
} }
func TestGetAddress(t *testing.T) { func TestGetAddress(t *testing.T) {