This repository has been archived by the owner on May 19, 2022. It is now read-only.
forked from hootsuite/atlantis
/
mock_pull_cleaner.go
85 lines (71 loc) · 3.06 KB
/
mock_pull_cleaner.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
// Automatically generated by pegomock. DO NOT EDIT!
// Source: github.com/hootsuite/atlantis/server/events (interfaces: PullCleaner)
package mocks
import (
"reflect"
models "github.com/hootsuite/atlantis/server/events/models"
vcs "github.com/hootsuite/atlantis/server/events/vcs"
pegomock "github.com/petergtz/pegomock"
)
type MockPullCleaner struct {
fail func(message string, callerSkip ...int)
}
func NewMockPullCleaner() *MockPullCleaner {
return &MockPullCleaner{fail: pegomock.GlobalFailHandler}
}
func (mock *MockPullCleaner) CleanUpPull(repo models.Repo, pull models.PullRequest, host vcs.Host) error {
params := []pegomock.Param{repo, pull, host}
result := pegomock.GetGenericMockFrom(mock).Invoke("CleanUpPull", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
}
}
return ret0
}
func (mock *MockPullCleaner) VerifyWasCalledOnce() *VerifierPullCleaner {
return &VerifierPullCleaner{mock, pegomock.Times(1), nil}
}
func (mock *MockPullCleaner) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierPullCleaner {
return &VerifierPullCleaner{mock, invocationCountMatcher, nil}
}
func (mock *MockPullCleaner) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierPullCleaner {
return &VerifierPullCleaner{mock, invocationCountMatcher, inOrderContext}
}
type VerifierPullCleaner struct {
mock *MockPullCleaner
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
}
func (verifier *VerifierPullCleaner) CleanUpPull(repo models.Repo, pull models.PullRequest, host vcs.Host) *PullCleaner_CleanUpPull_OngoingVerification {
params := []pegomock.Param{repo, pull, host}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CleanUpPull", params)
return &PullCleaner_CleanUpPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type PullCleaner_CleanUpPull_OngoingVerification struct {
mock *MockPullCleaner
methodInvocations []pegomock.MethodInvocation
}
func (c *PullCleaner_CleanUpPull_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, vcs.Host) {
repo, pull, host := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1], host[len(host)-1]
}
func (c *PullCleaner_CleanUpPull_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []vcs.Host) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
for u, param := range params[0] {
_param0[u] = param.(models.Repo)
}
_param1 = make([]models.PullRequest, len(params[1]))
for u, param := range params[1] {
_param1[u] = param.(models.PullRequest)
}
_param2 = make([]vcs.Host, len(params[2]))
for u, param := range params[2] {
_param2[u] = param.(vcs.Host)
}
}
return
}