helpers/gcp_secret_manager/service/mock_getTokenFunc.go (69 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"
sts "google.golang.org/api/sts/v1"
)
// mockGetTokenFunc is an autogenerated mock type for the getTokenFunc type
type mockGetTokenFunc struct {
mock.Mock
}
type mockGetTokenFunc_Expecter struct {
mock *mock.Mock
}
func (_m *mockGetTokenFunc) EXPECT() *mockGetTokenFunc_Expecter {
return &mockGetTokenFunc_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: ctx, secret
func (_m *mockGetTokenFunc) Execute(ctx context.Context, secret *common.GCPSecretManagerSecret) (*sts.GoogleIdentityStsV1ExchangeTokenResponse, error) {
ret := _m.Called(ctx, secret)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 *sts.GoogleIdentityStsV1ExchangeTokenResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *common.GCPSecretManagerSecret) (*sts.GoogleIdentityStsV1ExchangeTokenResponse, error)); ok {
return rf(ctx, secret)
}
if rf, ok := ret.Get(0).(func(context.Context, *common.GCPSecretManagerSecret) *sts.GoogleIdentityStsV1ExchangeTokenResponse); ok {
r0 = rf(ctx, secret)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*sts.GoogleIdentityStsV1ExchangeTokenResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *common.GCPSecretManagerSecret) error); ok {
r1 = rf(ctx, secret)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// mockGetTokenFunc_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type mockGetTokenFunc_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - ctx context.Context
// - secret *common.GCPSecretManagerSecret
func (_e *mockGetTokenFunc_Expecter) Execute(ctx interface{}, secret interface{}) *mockGetTokenFunc_Execute_Call {
return &mockGetTokenFunc_Execute_Call{Call: _e.mock.On("Execute", ctx, secret)}
}
func (_c *mockGetTokenFunc_Execute_Call) Run(run func(ctx context.Context, secret *common.GCPSecretManagerSecret)) *mockGetTokenFunc_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*common.GCPSecretManagerSecret))
})
return _c
}
func (_c *mockGetTokenFunc_Execute_Call) Return(_a0 *sts.GoogleIdentityStsV1ExchangeTokenResponse, _a1 error) *mockGetTokenFunc_Execute_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *mockGetTokenFunc_Execute_Call) RunAndReturn(run func(context.Context, *common.GCPSecretManagerSecret) (*sts.GoogleIdentityStsV1ExchangeTokenResponse, error)) *mockGetTokenFunc_Execute_Call {
_c.Call.Return(run)
return _c
}
// newMockGetTokenFunc creates a new instance of mockGetTokenFunc. 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 newMockGetTokenFunc(t interface {
mock.TestingT
Cleanup(func())
}) *mockGetTokenFunc {
mock := &mockGetTokenFunc{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}