mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-01 18:38:44 +00:00
* Moved CommandContext and CommandResult to models (#193) * Moved CommandContext and CommandResult to models * move from models to command rename CommandContext -> Context rename CommandResult -> Result * moved command related helpers into command package * move ProjectCommandContext and ProjectResult to command/project package * move project command context and project result * revert unrelated code * move tests * fix left over * fix linting * fix tests * remove unused import * fix project context dependencies * fix depenedecies * fix typo
236 lines
10 KiB
Go
236 lines
10 KiB
Go
// Code generated by pegomock. DO NOT EDIT.
|
|
// Source: github.com/runatlantis/atlantis/server/events (interfaces: CommitStatusUpdater)
|
|
|
|
package mocks
|
|
|
|
import (
|
|
"reflect"
|
|
"time"
|
|
|
|
pegomock "github.com/petergtz/pegomock"
|
|
"github.com/runatlantis/atlantis/server/events/command"
|
|
models "github.com/runatlantis/atlantis/server/events/models"
|
|
)
|
|
|
|
type MockCommitStatusUpdater struct {
|
|
fail func(message string, callerSkip ...int)
|
|
}
|
|
|
|
func NewMockCommitStatusUpdater(options ...pegomock.Option) *MockCommitStatusUpdater {
|
|
mock := &MockCommitStatusUpdater{}
|
|
for _, option := range options {
|
|
option.Apply(mock)
|
|
}
|
|
return mock
|
|
}
|
|
|
|
func (mock *MockCommitStatusUpdater) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
|
|
func (mock *MockCommitStatusUpdater) FailHandler() pegomock.FailHandler { return mock.fail }
|
|
|
|
func (mock *MockCommitStatusUpdater) UpdateCombined(repo models.Repo, pull models.PullRequest, status models.CommitStatus, command command.Name) error {
|
|
if mock == nil {
|
|
panic("mock must not be nil. Use myMock := NewMockCommitStatusUpdater().")
|
|
}
|
|
params := []pegomock.Param{repo, pull, status, command}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateCombined", 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 *MockCommitStatusUpdater) UpdateCombinedCount(repo models.Repo, pull models.PullRequest, status models.CommitStatus, command command.Name, numSuccess int, numTotal int) error {
|
|
if mock == nil {
|
|
panic("mock must not be nil. Use myMock := NewMockCommitStatusUpdater().")
|
|
}
|
|
params := []pegomock.Param{repo, pull, status, command, numSuccess, numTotal}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateCombinedCount", 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 *MockCommitStatusUpdater) UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string) error {
|
|
if mock == nil {
|
|
panic("mock must not be nil. Use myMock := NewMockCommitStatusUpdater().")
|
|
}
|
|
params := []pegomock.Param{ctx, cmdName, status, url}
|
|
result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateProject", 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 *MockCommitStatusUpdater) VerifyWasCalledOnce() *VerifierMockCommitStatusUpdater {
|
|
return &VerifierMockCommitStatusUpdater{
|
|
mock: mock,
|
|
invocationCountMatcher: pegomock.Times(1),
|
|
}
|
|
}
|
|
|
|
func (mock *MockCommitStatusUpdater) VerifyWasCalled(invocationCountMatcher pegomock.InvocationCountMatcher) *VerifierMockCommitStatusUpdater {
|
|
return &VerifierMockCommitStatusUpdater{
|
|
mock: mock,
|
|
invocationCountMatcher: invocationCountMatcher,
|
|
}
|
|
}
|
|
|
|
func (mock *MockCommitStatusUpdater) VerifyWasCalledInOrder(invocationCountMatcher pegomock.InvocationCountMatcher, inOrderContext *pegomock.InOrderContext) *VerifierMockCommitStatusUpdater {
|
|
return &VerifierMockCommitStatusUpdater{
|
|
mock: mock,
|
|
invocationCountMatcher: invocationCountMatcher,
|
|
inOrderContext: inOrderContext,
|
|
}
|
|
}
|
|
|
|
func (mock *MockCommitStatusUpdater) VerifyWasCalledEventually(invocationCountMatcher pegomock.InvocationCountMatcher, timeout time.Duration) *VerifierMockCommitStatusUpdater {
|
|
return &VerifierMockCommitStatusUpdater{
|
|
mock: mock,
|
|
invocationCountMatcher: invocationCountMatcher,
|
|
timeout: timeout,
|
|
}
|
|
}
|
|
|
|
type VerifierMockCommitStatusUpdater struct {
|
|
mock *MockCommitStatusUpdater
|
|
invocationCountMatcher pegomock.InvocationCountMatcher
|
|
inOrderContext *pegomock.InOrderContext
|
|
timeout time.Duration
|
|
}
|
|
|
|
func (verifier *VerifierMockCommitStatusUpdater) UpdateCombined(repo models.Repo, pull models.PullRequest, status models.CommitStatus, command command.Name) *MockCommitStatusUpdater_UpdateCombined_OngoingVerification {
|
|
params := []pegomock.Param{repo, pull, status, command}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateCombined", params, verifier.timeout)
|
|
return &MockCommitStatusUpdater_UpdateCombined_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type MockCommitStatusUpdater_UpdateCombined_OngoingVerification struct {
|
|
mock *MockCommitStatusUpdater
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *MockCommitStatusUpdater_UpdateCombined_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, models.CommitStatus, command.Name) {
|
|
repo, pull, status, command := c.GetAllCapturedArguments()
|
|
return repo[len(repo)-1], pull[len(pull)-1], status[len(status)-1], command[len(command)-1]
|
|
}
|
|
|
|
func (c *MockCommitStatusUpdater_UpdateCombined_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []models.CommitStatus, _param3 []command.Name) {
|
|
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)
|
|
}
|
|
_param2 = make([]models.CommitStatus, len(c.methodInvocations))
|
|
for u, param := range params[2] {
|
|
_param2[u] = param.(models.CommitStatus)
|
|
}
|
|
_param3 = make([]command.Name, len(c.methodInvocations))
|
|
for u, param := range params[3] {
|
|
_param3[u] = param.(command.Name)
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
func (verifier *VerifierMockCommitStatusUpdater) UpdateCombinedCount(repo models.Repo, pull models.PullRequest, status models.CommitStatus, cmd command.Name, numSuccess int, numTotal int) *MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification {
|
|
params := []pegomock.Param{repo, pull, status, cmd, numSuccess, numTotal}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateCombinedCount", params, verifier.timeout)
|
|
return &MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification struct {
|
|
mock *MockCommitStatusUpdater
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, models.CommitStatus, command.Name, int, int) {
|
|
repo, pull, status, command, numSuccess, numTotal := c.GetAllCapturedArguments()
|
|
return repo[len(repo)-1], pull[len(pull)-1], status[len(status)-1], command[len(command)-1], numSuccess[len(numSuccess)-1], numTotal[len(numTotal)-1]
|
|
}
|
|
|
|
func (c *MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []models.CommitStatus, _param3 []command.Name, _param4 []int, _param5 []int) {
|
|
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)
|
|
}
|
|
_param2 = make([]models.CommitStatus, len(c.methodInvocations))
|
|
for u, param := range params[2] {
|
|
_param2[u] = param.(models.CommitStatus)
|
|
}
|
|
_param3 = make([]command.Name, len(c.methodInvocations))
|
|
for u, param := range params[3] {
|
|
_param3[u] = param.(command.Name)
|
|
}
|
|
_param4 = make([]int, len(c.methodInvocations))
|
|
for u, param := range params[4] {
|
|
_param4[u] = param.(int)
|
|
}
|
|
_param5 = make([]int, len(c.methodInvocations))
|
|
for u, param := range params[5] {
|
|
_param5[u] = param.(int)
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
func (verifier *VerifierMockCommitStatusUpdater) UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string) *MockCommitStatusUpdater_UpdateProject_OngoingVerification {
|
|
params := []pegomock.Param{ctx, cmdName, status, url}
|
|
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateProject", params, verifier.timeout)
|
|
return &MockCommitStatusUpdater_UpdateProject_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
|
|
}
|
|
|
|
type MockCommitStatusUpdater_UpdateProject_OngoingVerification struct {
|
|
mock *MockCommitStatusUpdater
|
|
methodInvocations []pegomock.MethodInvocation
|
|
}
|
|
|
|
func (c *MockCommitStatusUpdater_UpdateProject_OngoingVerification) GetCapturedArguments() (command.ProjectContext, command.Name, models.CommitStatus, string) {
|
|
ctx, cmdName, status, url := c.GetAllCapturedArguments()
|
|
return ctx[len(ctx)-1], cmdName[len(cmdName)-1], status[len(status)-1], url[len(url)-1]
|
|
}
|
|
|
|
func (c *MockCommitStatusUpdater_UpdateProject_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []command.Name, _param2 []models.CommitStatus, _param3 []string) {
|
|
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
|
|
if len(params) > 0 {
|
|
_param0 = make([]command.ProjectContext, len(c.methodInvocations))
|
|
for u, param := range params[0] {
|
|
_param0[u] = param.(command.ProjectContext)
|
|
}
|
|
_param1 = make([]command.Name, len(c.methodInvocations))
|
|
for u, param := range params[1] {
|
|
_param1[u] = param.(command.Name)
|
|
}
|
|
_param2 = make([]models.CommitStatus, len(c.methodInvocations))
|
|
for u, param := range params[2] {
|
|
_param2[u] = param.(models.CommitStatus)
|
|
}
|
|
_param3 = make([]string, len(c.methodInvocations))
|
|
for u, param := range params[3] {
|
|
_param3[u] = param.(string)
|
|
}
|
|
}
|
|
return
|
|
}
|