helpers/gcp_secret_manager/service/mock_accessSecretFunc.go (70 lines of code) (raw):
// Code generated by mockery v2.53.3. DO NOT EDIT.
package service
import (
context "context"
common "gitlab.com/gitlab-org/gitlab-runner/common"
mock "github.com/stretchr/testify/mock"
oauth2 "golang.org/x/oauth2"
secretmanagerpb "cloud.google.com/go/secretmanager/apiv1/secretmanagerpb"
)
// mockAccessSecretFunc is an autogenerated mock type for the accessSecretFunc type
type mockAccessSecretFunc struct {
mock.Mock
}
type mockAccessSecretFunc_Expecter struct {
mock *mock.Mock
}
func (_m *mockAccessSecretFunc) EXPECT() *mockAccessSecretFunc_Expecter {
return &mockAccessSecretFunc_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: ctx, secret, source
func (_m *mockAccessSecretFunc) Execute(ctx context.Context, secret *common.GCPSecretManagerSecret, source oauth2.TokenSource) (*secretmanagerpb.AccessSecretVersionResponse, error) {
ret := _m.Called(ctx, secret, source)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 *secretmanagerpb.AccessSecretVersionResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *common.GCPSecretManagerSecret, oauth2.TokenSource) (*secretmanagerpb.AccessSecretVersionResponse, error)); ok {
return rf(ctx, secret, source)
}
if rf, ok := ret.Get(0).(func(context.Context, *common.GCPSecretManagerSecret, oauth2.TokenSource) *secretmanagerpb.AccessSecretVersionResponse); ok {
r0 = rf(ctx, secret, source)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*secretmanagerpb.AccessSecretVersionResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *common.GCPSecretManagerSecret, oauth2.TokenSource) error); ok {
r1 = rf(ctx, secret, source)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// mockAccessSecretFunc_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type mockAccessSecretFunc_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - ctx context.Context
// - secret *common.GCPSecretManagerSecret
// - source oauth2.TokenSource
func (_e *mockAccessSecretFunc_Expecter) Execute(ctx interface{}, secret interface{}, source interface{}) *mockAccessSecretFunc_Execute_Call {
return &mockAccessSecretFunc_Execute_Call{Call: _e.mock.On("Execute", ctx, secret, source)}
}
func (_c *mockAccessSecretFunc_Execute_Call) Run(run func(ctx context.Context, secret *common.GCPSecretManagerSecret, source oauth2.TokenSource)) *mockAccessSecretFunc_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*common.GCPSecretManagerSecret), args[2].(oauth2.TokenSource))
})
return _c
}
func (_c *mockAccessSecretFunc_Execute_Call) Return(_a0 *secretmanagerpb.AccessSecretVersionResponse, _a1 error) *mockAccessSecretFunc_Execute_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *mockAccessSecretFunc_Execute_Call) RunAndReturn(run func(context.Context, *common.GCPSecretManagerSecret, oauth2.TokenSource) (*secretmanagerpb.AccessSecretVersionResponse, error)) *mockAccessSecretFunc_Execute_Call {
_c.Call.Return(run)
return _c
}
// newMockAccessSecretFunc creates a new instance of mockAccessSecretFunc. 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 newMockAccessSecretFunc(t interface {
mock.TestingT
Cleanup(func())
}) *mockAccessSecretFunc {
mock := &mockAccessSecretFunc{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}