diff --git a/test/mocks/mock_utils/http/mock_http.go b/test/mocks/mock_utils/http/mock_http.go new file mode 100644 index 00000000..6448f6e4 --- /dev/null +++ b/test/mocks/mock_utils/http/mock_http.go @@ -0,0 +1,25 @@ +package mock_executor + +import ( + "soarca/utils/http" + + "github.com/stretchr/testify/mock" +) + +type MockHttpOptions struct { + mock.Mock +} + +type MockHttpRequest struct { + mock.Mock +} + +func (httpOptions *MockHttpOptions) ExtractUrl() (string, error) { + args := httpOptions.Called() + return args.String(0), args.Error(1) +} + +func (httpOptions *MockHttpRequest) Request(options http.HttpOptions) ([]byte, error) { + args := httpOptions.Called(options) + return args.Get(0).([]byte), args.Error(1) +} diff --git a/utils/http/http.go b/utils/http/http.go index c61672cc..3d9145ff 100644 --- a/utils/http/http.go +++ b/utils/http/http.go @@ -27,8 +27,11 @@ type HttpOptions struct { Auth *cacao.AuthenticationInformation } +type IHttpOptions interface { + ExtractUrl() (string, error) +} type IHttpRequest interface { - Request() ([]byte, error) + Request(httpOptions HttpOptions) ([]byte, error) } type HttpRequest struct{}