diff --git a/internal/inventory/azurefetcher/mock_activedirectory_provider.go b/internal/inventory/azurefetcher/mock_activedirectory_provider.go new file mode 100644 index 0000000000..9aecc656a8 --- /dev/null +++ b/internal/inventory/azurefetcher/mock_activedirectory_provider.go @@ -0,0 +1,108 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated by mockery v2.37.1. DO NOT EDIT. + +package azurefetcher + +import ( + context "context" + + models "github.com/microsoftgraph/msgraph-sdk-go/models" + mock "github.com/stretchr/testify/mock" +) + +// mockActivedirectoryProvider is an autogenerated mock type for the activedirectoryProvider type +type mockActivedirectoryProvider struct { + mock.Mock +} + +type mockActivedirectoryProvider_Expecter struct { + mock *mock.Mock +} + +func (_m *mockActivedirectoryProvider) EXPECT() *mockActivedirectoryProvider_Expecter { + return &mockActivedirectoryProvider_Expecter{mock: &_m.Mock} +} + +// ListServicePrincipals provides a mock function with given fields: ctx +func (_m *mockActivedirectoryProvider) ListServicePrincipals(ctx context.Context) ([]*models.ServicePrincipal, error) { + ret := _m.Called(ctx) + + var r0 []*models.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) ([]*models.ServicePrincipal, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) []*models.ServicePrincipal); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*models.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// mockActivedirectoryProvider_ListServicePrincipals_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListServicePrincipals' +type mockActivedirectoryProvider_ListServicePrincipals_Call struct { + *mock.Call +} + +// ListServicePrincipals is a helper method to define mock.On call +// - ctx context.Context +func (_e *mockActivedirectoryProvider_Expecter) ListServicePrincipals(ctx interface{}) *mockActivedirectoryProvider_ListServicePrincipals_Call { + return &mockActivedirectoryProvider_ListServicePrincipals_Call{Call: _e.mock.On("ListServicePrincipals", ctx)} +} + +func (_c *mockActivedirectoryProvider_ListServicePrincipals_Call) Run(run func(ctx context.Context)) *mockActivedirectoryProvider_ListServicePrincipals_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *mockActivedirectoryProvider_ListServicePrincipals_Call) Return(_a0 []*models.ServicePrincipal, _a1 error) *mockActivedirectoryProvider_ListServicePrincipals_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *mockActivedirectoryProvider_ListServicePrincipals_Call) RunAndReturn(run func(context.Context) ([]*models.ServicePrincipal, error)) *mockActivedirectoryProvider_ListServicePrincipals_Call { + _c.Call.Return(run) + return _c +} + +// newMockActivedirectoryProvider creates a new instance of mockActivedirectoryProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func newMockActivedirectoryProvider(t interface { + mock.TestingT + Cleanup(func()) +}) *mockActivedirectoryProvider { + mock := &mockActivedirectoryProvider{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/inventory/azurefetcher/mock_activedirectory_provider_func.go b/internal/inventory/azurefetcher/mock_activedirectory_provider_func.go new file mode 100644 index 0000000000..b9688da8a7 --- /dev/null +++ b/internal/inventory/azurefetcher/mock_activedirectory_provider_func.go @@ -0,0 +1,108 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated by mockery v2.37.1. DO NOT EDIT. + +package azurefetcher + +import ( + context "context" + + inventory "github.com/elastic/cloudbeat/internal/resources/providers/azurelib/inventory" + mock "github.com/stretchr/testify/mock" +) + +// mockActivedirectoryProviderFunc is an autogenerated mock type for the activedirectoryProviderFunc type +type mockActivedirectoryProviderFunc struct { + mock.Mock +} + +type mockActivedirectoryProviderFunc_Expecter struct { + mock *mock.Mock +} + +func (_m *mockActivedirectoryProviderFunc) EXPECT() *mockActivedirectoryProviderFunc_Expecter { + return &mockActivedirectoryProviderFunc_Expecter{mock: &_m.Mock} +} + +// Execute provides a mock function with given fields: _a0 +func (_m *mockActivedirectoryProviderFunc) Execute(_a0 context.Context) ([]inventory.AzureAsset, error) { + ret := _m.Called(_a0) + + var r0 []inventory.AzureAsset + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) ([]inventory.AzureAsset, error)); ok { + return rf(_a0) + } + if rf, ok := ret.Get(0).(func(context.Context) []inventory.AzureAsset); ok { + r0 = rf(_a0) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]inventory.AzureAsset) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(_a0) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// mockActivedirectoryProviderFunc_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute' +type mockActivedirectoryProviderFunc_Execute_Call struct { + *mock.Call +} + +// Execute is a helper method to define mock.On call +// - _a0 context.Context +func (_e *mockActivedirectoryProviderFunc_Expecter) Execute(_a0 interface{}) *mockActivedirectoryProviderFunc_Execute_Call { + return &mockActivedirectoryProviderFunc_Execute_Call{Call: _e.mock.On("Execute", _a0)} +} + +func (_c *mockActivedirectoryProviderFunc_Execute_Call) Run(run func(_a0 context.Context)) *mockActivedirectoryProviderFunc_Execute_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *mockActivedirectoryProviderFunc_Execute_Call) Return(_a0 []inventory.AzureAsset, _a1 error) *mockActivedirectoryProviderFunc_Execute_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *mockActivedirectoryProviderFunc_Execute_Call) RunAndReturn(run func(context.Context) ([]inventory.AzureAsset, error)) *mockActivedirectoryProviderFunc_Execute_Call { + _c.Call.Return(run) + return _c +} + +// newMockActivedirectoryProviderFunc creates a new instance of mockActivedirectoryProviderFunc. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func newMockActivedirectoryProviderFunc(t interface { + mock.TestingT + Cleanup(func()) +}) *mockActivedirectoryProviderFunc { + mock := &mockActivedirectoryProviderFunc{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/resources/providers/msgraph/mock_provider_api.go b/internal/resources/providers/msgraph/mock_provider_api.go new file mode 100644 index 0000000000..e3ecf4ef64 --- /dev/null +++ b/internal/resources/providers/msgraph/mock_provider_api.go @@ -0,0 +1,108 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Code generated by mockery v2.37.1. DO NOT EDIT. + +package msgraph + +import ( + context "context" + + models "github.com/microsoftgraph/msgraph-sdk-go/models" + mock "github.com/stretchr/testify/mock" +) + +// MockProviderAPI is an autogenerated mock type for the ProviderAPI type +type MockProviderAPI struct { + mock.Mock +} + +type MockProviderAPI_Expecter struct { + mock *mock.Mock +} + +func (_m *MockProviderAPI) EXPECT() *MockProviderAPI_Expecter { + return &MockProviderAPI_Expecter{mock: &_m.Mock} +} + +// ListServicePrincipals provides a mock function with given fields: _a0 +func (_m *MockProviderAPI) ListServicePrincipals(_a0 context.Context) ([]*models.ServicePrincipal, error) { + ret := _m.Called(_a0) + + var r0 []*models.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) ([]*models.ServicePrincipal, error)); ok { + return rf(_a0) + } + if rf, ok := ret.Get(0).(func(context.Context) []*models.ServicePrincipal); ok { + r0 = rf(_a0) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*models.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(_a0) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockProviderAPI_ListServicePrincipals_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListServicePrincipals' +type MockProviderAPI_ListServicePrincipals_Call struct { + *mock.Call +} + +// ListServicePrincipals is a helper method to define mock.On call +// - _a0 context.Context +func (_e *MockProviderAPI_Expecter) ListServicePrincipals(_a0 interface{}) *MockProviderAPI_ListServicePrincipals_Call { + return &MockProviderAPI_ListServicePrincipals_Call{Call: _e.mock.On("ListServicePrincipals", _a0)} +} + +func (_c *MockProviderAPI_ListServicePrincipals_Call) Run(run func(_a0 context.Context)) *MockProviderAPI_ListServicePrincipals_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockProviderAPI_ListServicePrincipals_Call) Return(_a0 []*models.ServicePrincipal, _a1 error) *MockProviderAPI_ListServicePrincipals_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockProviderAPI_ListServicePrincipals_Call) RunAndReturn(run func(context.Context) ([]*models.ServicePrincipal, error)) *MockProviderAPI_ListServicePrincipals_Call { + _c.Call.Return(run) + return _c +} + +// NewMockProviderAPI creates a new instance of MockProviderAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockProviderAPI(t interface { + mock.TestingT + Cleanup(func()) +}) *MockProviderAPI { + mock := &MockProviderAPI{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}