Files
atlantis/server/events/mocks/mock_webhooks_sender.go
2024-11-16 15:00:42 +00:00

115 lines
4.0 KiB
Go

// Code generated by pegomock. DO NOT EDIT.
// Source: github.com/runatlantis/atlantis/server/events (interfaces: WebhooksSender)
package mocks
import (
pegomock "github.com/petergtz/pegomock/v4"
webhooks "github.com/runatlantis/atlantis/server/events/webhooks"
logging "github.com/runatlantis/atlantis/server/logging"
"reflect"
"time"
)
type MockWebhooksSender struct {
fail func(message string, callerSkip ...int)
}
func NewMockWebhooksSender(options ...pegomock.Option) *MockWebhooksSender {
mock := &MockWebhooksSender{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockWebhooksSender) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockWebhooksSender) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockWebhooksSender) Send(log logging.SimpleLogging, res webhooks.ApplyResult) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockWebhooksSender().")
}
_params := []pegomock.Param{log, res}
_result := pegomock.GetGenericMockFrom(mock).Invoke("Send", _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 *MockWebhooksSender) VerifyWasCalledOnce() *VerifierMockWebhooksSender {
return &VerifierMockWebhooksSender{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockWebhooksSender) VerifyWasCalled(invocationCountMatcher pegomock.InvocationCountMatcher) *VerifierMockWebhooksSender {
return &VerifierMockWebhooksSender{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockWebhooksSender) VerifyWasCalledInOrder(invocationCountMatcher pegomock.InvocationCountMatcher, inOrderContext *pegomock.InOrderContext) *VerifierMockWebhooksSender {
return &VerifierMockWebhooksSender{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockWebhooksSender) VerifyWasCalledEventually(invocationCountMatcher pegomock.InvocationCountMatcher, timeout time.Duration) *VerifierMockWebhooksSender {
return &VerifierMockWebhooksSender{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierMockWebhooksSender struct {
mock *MockWebhooksSender
invocationCountMatcher pegomock.InvocationCountMatcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierMockWebhooksSender) Send(log logging.SimpleLogging, res webhooks.ApplyResult) *MockWebhooksSender_Send_OngoingVerification {
_params := []pegomock.Param{log, res}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Send", _params, verifier.timeout)
return &MockWebhooksSender_Send_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockWebhooksSender_Send_OngoingVerification struct {
mock *MockWebhooksSender
methodInvocations []pegomock.MethodInvocation
}
func (c *MockWebhooksSender_Send_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, webhooks.ApplyResult) {
log, res := c.GetAllCapturedArguments()
return log[len(log)-1], res[len(res)-1]
}
func (c *MockWebhooksSender_Send_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []webhooks.ApplyResult) {
_params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(_params) > 0 {
if len(_params) > 0 {
_param0 = make([]logging.SimpleLogging, len(c.methodInvocations))
for u, param := range _params[0] {
_param0[u] = param.(logging.SimpleLogging)
}
}
if len(_params) > 1 {
_param1 = make([]webhooks.ApplyResult, len(c.methodInvocations))
for u, param := range _params[1] {
_param1[u] = param.(webhooks.ApplyResult)
}
}
}
return
}