forked from cloudposse-archives/atlantis-experiments
/
mock_working_dir_locker.go
127 lines (108 loc) · 4.82 KB
/
mock_working_dir_locker.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// Automatically generated by pegomock. DO NOT EDIT!
// Source: github.com/runatlantis/atlantis/server/events (interfaces: WorkingDirLocker)
package mocks
import (
"reflect"
pegomock "github.com/petergtz/pegomock"
)
type MockWorkingDirLocker struct {
fail func(message string, callerSkip ...int)
}
func NewMockWorkingDirLocker() *MockWorkingDirLocker {
return &MockWorkingDirLocker{fail: pegomock.GlobalFailHandler}
}
func (mock *MockWorkingDirLocker) TryLock(repoFullName string, workspace string, pullNum int) (func(), error) {
params := []pegomock.Param{repoFullName, workspace, pullNum}
result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", params, []reflect.Type{reflect.TypeOf((*func())(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 func()
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(func())
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockWorkingDirLocker) Unlock(repoFullName string, workspace string, pullNum int) {
params := []pegomock.Param{repoFullName, workspace, pullNum}
pegomock.GetGenericMockFrom(mock).Invoke("Unlock", params, []reflect.Type{})
}
func (mock *MockWorkingDirLocker) VerifyWasCalledOnce() *VerifierWorkingDirLocker {
return &VerifierWorkingDirLocker{mock, pegomock.Times(1), nil}
}
func (mock *MockWorkingDirLocker) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierWorkingDirLocker {
return &VerifierWorkingDirLocker{mock, invocationCountMatcher, nil}
}
func (mock *MockWorkingDirLocker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierWorkingDirLocker {
return &VerifierWorkingDirLocker{mock, invocationCountMatcher, inOrderContext}
}
type VerifierWorkingDirLocker struct {
mock *MockWorkingDirLocker
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
}
func (verifier *VerifierWorkingDirLocker) TryLock(repoFullName string, workspace string, pullNum int) *WorkingDirLocker_TryLock_OngoingVerification {
params := []pegomock.Param{repoFullName, workspace, pullNum}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params)
return &WorkingDirLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDirLocker_TryLock_OngoingVerification struct {
mock *MockWorkingDirLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDirLocker_TryLock_OngoingVerification) GetCapturedArguments() (string, string, int) {
repoFullName, workspace, pullNum := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], workspace[len(workspace)-1], pullNum[len(pullNum)-1]
}
func (c *WorkingDirLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []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([]string, len(params[1]))
for u, param := range params[1] {
_param1[u] = param.(string)
}
_param2 = make([]int, len(params[2]))
for u, param := range params[2] {
_param2[u] = param.(int)
}
}
return
}
func (verifier *VerifierWorkingDirLocker) Unlock(repoFullName string, workspace string, pullNum int) *WorkingDirLocker_Unlock_OngoingVerification {
params := []pegomock.Param{repoFullName, workspace, pullNum}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Unlock", params)
return &WorkingDirLocker_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDirLocker_Unlock_OngoingVerification struct {
mock *MockWorkingDirLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDirLocker_Unlock_OngoingVerification) GetCapturedArguments() (string, string, int) {
repoFullName, workspace, pullNum := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], workspace[len(workspace)-1], pullNum[len(pullNum)-1]
}
func (c *WorkingDirLocker_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []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([]string, len(params[1]))
for u, param := range params[1] {
_param1[u] = param.(string)
}
_param2 = make([]int, len(params[2]))
for u, param := range params[2] {
_param2[u] = param.(int)
}
}
return
}