Files
atlantis/server/events/mocks/mock_delete_lock_command.go
Ken Kaizu 3954955e13 fix(deps): update module github.com/petergtz/pegomock/v3 to v4 (#3534)
* fix(deps): update module github.com/petergtz/pegomock/v3 to v4 in go.mod

* remove pegomock generate m option, which is not support after v4

* make regen-mocks

* replace pegomock v4 primitive eq/matchers

* convert pegomock v4 Eq/Any matchers

* remove custom models.Repo matcher

* pegomock v4 cannot use result method args

ref https://github.com/petergtz/pegomock/issues/123

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-20 15:05:23 -04:00

160 lines
5.8 KiB
Go

// Code generated by pegomock. DO NOT EDIT.
// Source: github.com/runatlantis/atlantis/server/events (interfaces: DeleteLockCommand)
package mocks
import (
pegomock "github.com/petergtz/pegomock/v4"
models "github.com/runatlantis/atlantis/server/events/models"
"reflect"
"time"
)
type MockDeleteLockCommand struct {
fail func(message string, callerSkip ...int)
}
func NewMockDeleteLockCommand(options ...pegomock.Option) *MockDeleteLockCommand {
mock := &MockDeleteLockCommand{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockDeleteLockCommand) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockDeleteLockCommand) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockDeleteLockCommand) DeleteLock(id string) (*models.ProjectLock, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockDeleteLockCommand().")
}
params := []pegomock.Param{id}
result := pegomock.GetGenericMockFrom(mock).Invoke("DeleteLock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *models.ProjectLock
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(*models.ProjectLock)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockDeleteLockCommand) DeleteLocksByPull(repoFullName string, pullNum int) (int, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockDeleteLockCommand().")
}
params := []pegomock.Param{repoFullName, pullNum}
result := pegomock.GetGenericMockFrom(mock).Invoke("DeleteLocksByPull", params, []reflect.Type{reflect.TypeOf((*int)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 int
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(int)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockDeleteLockCommand) VerifyWasCalledOnce() *VerifierMockDeleteLockCommand {
return &VerifierMockDeleteLockCommand{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockDeleteLockCommand) VerifyWasCalled(invocationCountMatcher pegomock.InvocationCountMatcher) *VerifierMockDeleteLockCommand {
return &VerifierMockDeleteLockCommand{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockDeleteLockCommand) VerifyWasCalledInOrder(invocationCountMatcher pegomock.InvocationCountMatcher, inOrderContext *pegomock.InOrderContext) *VerifierMockDeleteLockCommand {
return &VerifierMockDeleteLockCommand{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockDeleteLockCommand) VerifyWasCalledEventually(invocationCountMatcher pegomock.InvocationCountMatcher, timeout time.Duration) *VerifierMockDeleteLockCommand {
return &VerifierMockDeleteLockCommand{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierMockDeleteLockCommand struct {
mock *MockDeleteLockCommand
invocationCountMatcher pegomock.InvocationCountMatcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierMockDeleteLockCommand) DeleteLock(id string) *MockDeleteLockCommand_DeleteLock_OngoingVerification {
params := []pegomock.Param{id}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeleteLock", params, verifier.timeout)
return &MockDeleteLockCommand_DeleteLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockDeleteLockCommand_DeleteLock_OngoingVerification struct {
mock *MockDeleteLockCommand
methodInvocations []pegomock.MethodInvocation
}
func (c *MockDeleteLockCommand_DeleteLock_OngoingVerification) GetCapturedArguments() string {
id := c.GetAllCapturedArguments()
return id[len(id)-1]
}
func (c *MockDeleteLockCommand_DeleteLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(string)
}
}
return
}
func (verifier *VerifierMockDeleteLockCommand) DeleteLocksByPull(repoFullName string, pullNum int) *MockDeleteLockCommand_DeleteLocksByPull_OngoingVerification {
params := []pegomock.Param{repoFullName, pullNum}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeleteLocksByPull", params, verifier.timeout)
return &MockDeleteLockCommand_DeleteLocksByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockDeleteLockCommand_DeleteLocksByPull_OngoingVerification struct {
mock *MockDeleteLockCommand
methodInvocations []pegomock.MethodInvocation
}
func (c *MockDeleteLockCommand_DeleteLocksByPull_OngoingVerification) GetCapturedArguments() (string, int) {
repoFullName, pullNum := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1]
}
func (c *MockDeleteLockCommand_DeleteLocksByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(c.methodInvocations))
for u, param := range params[0] {
_param0[u] = param.(string)
}
_param1 = make([]int, len(c.methodInvocations))
for u, param := range params[1] {
_param1[u] = param.(int)
}
}
return
}