mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-28 22:28:25 +00:00
* Update go-generate to run as a script It was taking forever to run via the previous Makefile command. I don't exactly know why. Perhaps because it was passing all the packages in as multiple arguments? Either way, this change allows it to actually run through in about 20 minutes. * Regenerate all mocks using latest pegomock Pegomock version v2.9.0 * Format mocks outside of regular mocks directory. These mocks are outside of the regular directory due to an import cycle causing us to have to have these not under a /mocks directory so they need to be formatted since they're not excluded. * Add back make test target
114 lines
4.2 KiB
Go
114 lines
4.2 KiB
Go
// Code generated by pegomock. DO NOT EDIT.
|
|
// Source: github.com/runatlantis/atlantis/server/events/runtime (interfaces: PullApprovedChecker)
|
|
|
|
package mocks
|
|
|
|
import (
|
|
pegomock "github.com/petergtz/pegomock"
|
|
models "github.com/runatlantis/atlantis/server/events/models"
|
|
"reflect"
|
|
"time"
|
|
)
|
|
|
|
type MockPullApprovedChecker struct {
|
|
fail func(message string, callerSkip ...int)
|
|
}
|
|
|
|
func NewMockPullApprovedChecker(options ...pegomock.Option) *MockPullApprovedChecker {
|
|
mock := &MockPullApprovedChecker{}
|
|
for _, option := range options {
|
|
option.Apply(mock)
|
|
}
|
|
return mock
|
|
}
|
|
|
|
func (mock *MockPullApprovedChecker) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
|
|
func (mock *MockPullApprovedChecker) FailHandler() pegomock.FailHandler { return mock.fail }
|
|
|
|
func (mock *MockPullApprovedChecker) PullIsApproved(baseRepo models.Repo, pull models.PullRequest) (bool, error) {
|
|
if mock == nil {
|
|
panic("mock must not be nil. Use myMock := NewMockPullApprovedChecker().")
|
|
}
|
|
params := []pegomock.Param{baseRepo, pull}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("PullIsApproved", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
|
|
var ret0 bool
|
|
var ret1 error
|
|
if len(result) != 0 {
|
|
if result[0] != nil {
|
|
ret0 = result[0].(bool)
|
|
}
|
|
if result[1] != nil {
|
|
ret1 = result[1].(error)
|
|
}
|
|
}
|
|
return ret0, ret1
|
|
}
|
|
|
|
func (mock *MockPullApprovedChecker) VerifyWasCalledOnce() *VerifierMockPullApprovedChecker {
|
|
return &VerifierMockPullApprovedChecker{
|
|
mock: mock,
|
|
invocationCountMatcher: pegomock.Times(1),
|
|
}
|
|
}
|
|
|
|
func (mock *MockPullApprovedChecker) VerifyWasCalled(invocationCountMatcher pegomock.InvocationCountMatcher) *VerifierMockPullApprovedChecker {
|
|
return &VerifierMockPullApprovedChecker{
|
|
mock: mock,
|
|
invocationCountMatcher: invocationCountMatcher,
|
|
}
|
|
}
|
|
|
|
func (mock *MockPullApprovedChecker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.InvocationCountMatcher, inOrderContext *pegomock.InOrderContext) *VerifierMockPullApprovedChecker {
|
|
return &VerifierMockPullApprovedChecker{
|
|
mock: mock,
|
|
invocationCountMatcher: invocationCountMatcher,
|
|
inOrderContext: inOrderContext,
|
|
}
|
|
}
|
|
|
|
func (mock *MockPullApprovedChecker) VerifyWasCalledEventually(invocationCountMatcher pegomock.InvocationCountMatcher, timeout time.Duration) *VerifierMockPullApprovedChecker {
|
|
return &VerifierMockPullApprovedChecker{
|
|
mock: mock,
|
|
invocationCountMatcher: invocationCountMatcher,
|
|
timeout: timeout,
|
|
}
|
|
}
|
|
|
|
type VerifierMockPullApprovedChecker struct {
|
|
mock *MockPullApprovedChecker
|
|
invocationCountMatcher pegomock.InvocationCountMatcher
|
|
inOrderContext *pegomock.InOrderContext
|
|
timeout time.Duration
|
|
}
|
|
|
|
func (verifier *VerifierMockPullApprovedChecker) PullIsApproved(baseRepo models.Repo, pull models.PullRequest) *MockPullApprovedChecker_PullIsApproved_OngoingVerification {
|
|
params := []pegomock.Param{baseRepo, pull}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PullIsApproved", params, verifier.timeout)
|
|
return &MockPullApprovedChecker_PullIsApproved_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type MockPullApprovedChecker_PullIsApproved_OngoingVerification struct {
|
|
mock *MockPullApprovedChecker
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *MockPullApprovedChecker_PullIsApproved_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
|
|
baseRepo, pull := c.GetAllCapturedArguments()
|
|
return baseRepo[len(baseRepo)-1], pull[len(pull)-1]
|
|
}
|
|
|
|
func (c *MockPullApprovedChecker_PullIsApproved_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
|
|
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
|
|
if len(params) > 0 {
|
|
_param0 = make([]models.Repo, len(c.methodInvocations))
|
|
for u, param := range params[0] {
|
|
_param0[u] = param.(models.Repo)
|
|
}
|
|
_param1 = make([]models.PullRequest, len(c.methodInvocations))
|
|
for u, param := range params[1] {
|
|
_param1[u] = param.(models.PullRequest)
|
|
}
|
|
}
|
|
return
|
|
}
|