mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-28 22:28:25 +00:00
258 lines
9.0 KiB
Go
258 lines
9.0 KiB
Go
// Automatically generated by pegomock. DO NOT EDIT!
|
|
// Source: github.com/hootsuite/atlantis/server/locking (interfaces: Backend)
|
|
|
|
package mocks
|
|
|
|
import (
|
|
models "github.com/hootsuite/atlantis/server/models"
|
|
pegomock "github.com/petergtz/pegomock"
|
|
"reflect"
|
|
)
|
|
|
|
type MockBackend struct {
|
|
fail func(message string, callerSkip ...int)
|
|
}
|
|
|
|
func NewMockBackend() *MockBackend {
|
|
return &MockBackend{fail: pegomock.GlobalFailHandler}
|
|
}
|
|
|
|
func (mock *MockBackend) TryLock(lock models.ProjectLock) (bool, models.ProjectLock, error) {
|
|
params := []pegomock.Param{lock}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
|
|
var ret0 bool
|
|
var ret1 models.ProjectLock
|
|
var ret2 error
|
|
if len(result) != 0 {
|
|
if result[0] != nil {
|
|
ret0 = result[0].(bool)
|
|
}
|
|
if result[1] != nil {
|
|
ret1 = result[1].(models.ProjectLock)
|
|
}
|
|
if result[2] != nil {
|
|
ret2 = result[2].(error)
|
|
}
|
|
}
|
|
return ret0, ret1, ret2
|
|
}
|
|
|
|
func (mock *MockBackend) Unlock(project models.Project, env string) (*models.ProjectLock, error) {
|
|
params := []pegomock.Param{project, env}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("Unlock", 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 *MockBackend) List() ([]models.ProjectLock, error) {
|
|
params := []pegomock.Param{}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("List", 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 *MockBackend) GetLock(project models.Project, env string) (*models.ProjectLock, error) {
|
|
params := []pegomock.Param{project, env}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("GetLock", 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 *MockBackend) UnlockByPull(repoFullName string, pullNum int) ([]models.ProjectLock, error) {
|
|
params := []pegomock.Param{repoFullName, pullNum}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("UnlockByPull", 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 *MockBackend) VerifyWasCalledOnce() *VerifierBackend {
|
|
return &VerifierBackend{mock, pegomock.Times(1), nil}
|
|
}
|
|
|
|
func (mock *MockBackend) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierBackend {
|
|
return &VerifierBackend{mock, invocationCountMatcher, nil}
|
|
}
|
|
|
|
func (mock *MockBackend) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierBackend {
|
|
return &VerifierBackend{mock, invocationCountMatcher, inOrderContext}
|
|
}
|
|
|
|
type VerifierBackend struct {
|
|
mock *MockBackend
|
|
invocationCountMatcher pegomock.Matcher
|
|
inOrderContext *pegomock.InOrderContext
|
|
}
|
|
|
|
func (verifier *VerifierBackend) TryLock(lock models.ProjectLock) *Backend_TryLock_OngoingVerification {
|
|
params := []pegomock.Param{lock}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params)
|
|
return &Backend_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type Backend_TryLock_OngoingVerification struct {
|
|
mock *MockBackend
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *Backend_TryLock_OngoingVerification) GetCapturedArguments() models.ProjectLock {
|
|
lock := c.GetAllCapturedArguments()
|
|
return lock[len(lock)-1]
|
|
}
|
|
|
|
func (c *Backend_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectLock) {
|
|
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
|
|
if len(params) > 0 {
|
|
_param0 = make([]models.ProjectLock, len(params[0]))
|
|
for u, param := range params[0] {
|
|
_param0[u] = param.(models.ProjectLock)
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
func (verifier *VerifierBackend) Unlock(project models.Project, env string) *Backend_Unlock_OngoingVerification {
|
|
params := []pegomock.Param{project, env}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Unlock", params)
|
|
return &Backend_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type Backend_Unlock_OngoingVerification struct {
|
|
mock *MockBackend
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *Backend_Unlock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
|
|
project, env := c.GetAllCapturedArguments()
|
|
return project[len(project)-1], env[len(env)-1]
|
|
}
|
|
|
|
func (c *Backend_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
|
|
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
|
|
if len(params) > 0 {
|
|
_param0 = make([]models.Project, len(params[0]))
|
|
for u, param := range params[0] {
|
|
_param0[u] = param.(models.Project)
|
|
}
|
|
_param1 = make([]string, len(params[1]))
|
|
for u, param := range params[1] {
|
|
_param1[u] = param.(string)
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
func (verifier *VerifierBackend) List() *Backend_List_OngoingVerification {
|
|
params := []pegomock.Param{}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "List", params)
|
|
return &Backend_List_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type Backend_List_OngoingVerification struct {
|
|
mock *MockBackend
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *Backend_List_OngoingVerification) GetCapturedArguments() {
|
|
}
|
|
|
|
func (c *Backend_List_OngoingVerification) GetAllCapturedArguments() {
|
|
}
|
|
|
|
func (verifier *VerifierBackend) GetLock(project models.Project, env string) *Backend_GetLock_OngoingVerification {
|
|
params := []pegomock.Param{project, env}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetLock", params)
|
|
return &Backend_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type Backend_GetLock_OngoingVerification struct {
|
|
mock *MockBackend
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *Backend_GetLock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
|
|
project, env := c.GetAllCapturedArguments()
|
|
return project[len(project)-1], env[len(env)-1]
|
|
}
|
|
|
|
func (c *Backend_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
|
|
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
|
|
if len(params) > 0 {
|
|
_param0 = make([]models.Project, len(params[0]))
|
|
for u, param := range params[0] {
|
|
_param0[u] = param.(models.Project)
|
|
}
|
|
_param1 = make([]string, len(params[1]))
|
|
for u, param := range params[1] {
|
|
_param1[u] = param.(string)
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
func (verifier *VerifierBackend) UnlockByPull(repoFullName string, pullNum int) *Backend_UnlockByPull_OngoingVerification {
|
|
params := []pegomock.Param{repoFullName, pullNum}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UnlockByPull", params)
|
|
return &Backend_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type Backend_UnlockByPull_OngoingVerification struct {
|
|
mock *MockBackend
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *Backend_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) {
|
|
repoFullName, pullNum := c.GetAllCapturedArguments()
|
|
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1]
|
|
}
|
|
|
|
func (c *Backend_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
|
|
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
|
|
if len(params) > 0 {
|
|
_param0 = make([]string, len(params[0]))
|
|
for u, param := range params[0] {
|
|
_param0[u] = param.(string)
|
|
}
|
|
_param1 = make([]int, len(params[1]))
|
|
for u, param := range params[1] {
|
|
_param1[u] = param.(int)
|
|
}
|
|
}
|
|
return
|
|
}
|