Files
atlantis/server/mocks/mock_github_request_validator.go
2019-06-14 14:39:26 +01:00

114 lines
4.0 KiB
Go

// Code generated by pegomock. DO NOT EDIT.
// Source: github.com/runatlantis/atlantis/server (interfaces: GithubRequestValidator)
package mocks
import (
pegomock "github.com/petergtz/pegomock"
http "net/http"
"reflect"
"time"
)
type MockGithubRequestValidator struct {
fail func(message string, callerSkip ...int)
}
func NewMockGithubRequestValidator(options ...pegomock.Option) *MockGithubRequestValidator {
mock := &MockGithubRequestValidator{}
for _, option := range options {
option.Apply(mock)
}
return mock
}
func (mock *MockGithubRequestValidator) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockGithubRequestValidator) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockGithubRequestValidator) Validate(r *http.Request, secret []byte) ([]byte, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockGithubRequestValidator().")
}
params := []pegomock.Param{r, secret}
result := pegomock.GetGenericMockFrom(mock).Invoke("Validate", params, []reflect.Type{reflect.TypeOf((*[]byte)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 []byte
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].([]byte)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockGithubRequestValidator) VerifyWasCalledOnce() *VerifierMockGithubRequestValidator {
return &VerifierMockGithubRequestValidator{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockGithubRequestValidator) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockGithubRequestValidator {
return &VerifierMockGithubRequestValidator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockGithubRequestValidator) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockGithubRequestValidator {
return &VerifierMockGithubRequestValidator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockGithubRequestValidator) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockGithubRequestValidator {
return &VerifierMockGithubRequestValidator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierMockGithubRequestValidator struct {
mock *MockGithubRequestValidator
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierMockGithubRequestValidator) Validate(r *http.Request, secret []byte) *MockGithubRequestValidator_Validate_OngoingVerification {
params := []pegomock.Param{r, secret}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Validate", params, verifier.timeout)
return &MockGithubRequestValidator_Validate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type MockGithubRequestValidator_Validate_OngoingVerification struct {
mock *MockGithubRequestValidator
methodInvocations []pegomock.MethodInvocation
}
func (c *MockGithubRequestValidator_Validate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte) {
r, secret := c.GetAllCapturedArguments()
return r[len(r)-1], secret[len(secret)-1]
}
func (c *MockGithubRequestValidator_Validate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*http.Request, len(params[0]))
for u, param := range params[0] {
_param0[u] = param.(*http.Request)
}
_param1 = make([][]byte, len(params[1]))
for u, param := range params[1] {
_param1[u] = param.([]byte)
}
}
return
}