Files
atlantis/server/events/mocks/mock_project_lock.go
2024-11-16 15:00:42 +00:00

144 lines
5.4 KiB
Go

// Code generated by pegomock. DO NOT EDIT.
// Source: github.com/runatlantis/atlantis/server/events (interfaces: ProjectLocker)
package mocks
import (
pegomock "github.com/petergtz/pegomock/v4"
events "github.com/runatlantis/atlantis/server/events"
models "github.com/runatlantis/atlantis/server/events/models"
logging "github.com/runatlantis/atlantis/server/logging"
"reflect"
"time"
)
type MockProjectLocker struct {
fail func(message string, callerSkip ...int)
}
func NewMockProjectLocker(options ...pegomock.Option) *MockProjectLocker {
mock := &MockProjectLocker{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockProjectLocker) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockProjectLocker) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockProjectLocker) TryLock(log logging.SimpleLogging, pull models.PullRequest, user models.User, workspace string, project models.Project, repoLocking bool) (*events.TryLockResponse, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockProjectLocker().")
}
_params := []pegomock.Param{log, pull, user, workspace, project, repoLocking}
_result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", _params, []reflect.Type{reflect.TypeOf((**events.TryLockResponse)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var _ret0 *events.TryLockResponse
var _ret1 error
if len(_result) != 0 {
if _result[0] != nil {
_ret0 = _result[0].(*events.TryLockResponse)
}
if _result[1] != nil {
_ret1 = _result[1].(error)
}
}
return _ret0, _ret1
}
func (mock *MockProjectLocker) VerifyWasCalledOnce() *VerifierMockProjectLocker {
return &VerifierMockProjectLocker{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockProjectLocker) VerifyWasCalled(invocationCountMatcher pegomock.InvocationCountMatcher) *VerifierMockProjectLocker {
return &VerifierMockProjectLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockProjectLocker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.InvocationCountMatcher, inOrderContext *pegomock.InOrderContext) *VerifierMockProjectLocker {
return &VerifierMockProjectLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockProjectLocker) VerifyWasCalledEventually(invocationCountMatcher pegomock.InvocationCountMatcher, timeout time.Duration) *VerifierMockProjectLocker {
return &VerifierMockProjectLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierMockProjectLocker struct {
mock *MockProjectLocker
invocationCountMatcher pegomock.InvocationCountMatcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierMockProjectLocker) TryLock(log logging.SimpleLogging, pull models.PullRequest, user models.User, workspace string, project models.Project, repoLocking bool) *MockProjectLocker_TryLock_OngoingVerification {
_params := []pegomock.Param{log, pull, user, workspace, project, repoLocking}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", _params, verifier.timeout)
return &MockProjectLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockProjectLocker_TryLock_OngoingVerification struct {
mock *MockProjectLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *MockProjectLocker_TryLock_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, models.PullRequest, models.User, string, models.Project, bool) {
log, pull, user, workspace, project, repoLocking := c.GetAllCapturedArguments()
return log[len(log)-1], pull[len(pull)-1], user[len(user)-1], workspace[len(workspace)-1], project[len(project)-1], repoLocking[len(repoLocking)-1]
}
func (c *MockProjectLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []models.PullRequest, _param2 []models.User, _param3 []string, _param4 []models.Project, _param5 []bool) {
_params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(_params) > 0 {
if len(_params) > 0 {
_param0 = make([]logging.SimpleLogging, len(c.methodInvocations))
for u, param := range _params[0] {
_param0[u] = param.(logging.SimpleLogging)
}
}
if len(_params) > 1 {
_param1 = make([]models.PullRequest, len(c.methodInvocations))
for u, param := range _params[1] {
_param1[u] = param.(models.PullRequest)
}
}
if len(_params) > 2 {
_param2 = make([]models.User, len(c.methodInvocations))
for u, param := range _params[2] {
_param2[u] = param.(models.User)
}
}
if len(_params) > 3 {
_param3 = make([]string, len(c.methodInvocations))
for u, param := range _params[3] {
_param3[u] = param.(string)
}
}
if len(_params) > 4 {
_param4 = make([]models.Project, len(c.methodInvocations))
for u, param := range _params[4] {
_param4[u] = param.(models.Project)
}
}
if len(_params) > 5 {
_param5 = make([]bool, len(c.methodInvocations))
for u, param := range _params[5] {
_param5[u] = param.(bool)
}
}
}
return
}