Files
atlantis/server/events/github/mocks/mock_client.go
2017-10-18 06:44:44 -07:00

285 lines
11 KiB
Go

// Automatically generated by pegomock. DO NOT EDIT!
// Source: client.go
package mocks
import (
github "github.com/google/go-github/github"
models "github.com/hootsuite/atlantis/server/events/models"
pegomock "github.com/petergtz/pegomock"
"reflect"
)
type MockClient struct {
fail func(message string, callerSkip ...int)
}
func NewMockClient() *MockClient {
return &MockClient{fail: pegomock.GlobalFailHandler}
}
func (mock *MockClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error) {
params := []pegomock.Param{repo, pull}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetModifiedFiles", params, []reflect.Type{reflect.TypeOf((*[]string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 []string
var ret1 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].([]string)
}
if result[1] != nil {
ret1 = result[1].(error)
}
}
return ret0, ret1
}
func (mock *MockClient) CreateComment(repo models.Repo, pull models.PullRequest, comment string) error {
params := []pegomock.Param{repo, pull, comment}
result := pegomock.GetGenericMockFrom(mock).Invoke("CreateComment", 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 *MockClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) {
params := []pegomock.Param{repo, 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 *MockClient) GetPullRequest(repo models.Repo, num int) (*github.PullRequest, *github.Response, error) {
params := []pegomock.Param{repo, num}
result := pegomock.GetGenericMockFrom(mock).Invoke("GetPullRequest", params, []reflect.Type{reflect.TypeOf((**github.PullRequest)(nil)).Elem(), reflect.TypeOf((**github.Response)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 *github.PullRequest
var ret1 *github.Response
var ret2 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(*github.PullRequest)
}
if result[1] != nil {
ret1 = result[1].(*github.Response)
}
if result[2] != nil {
ret2 = result[2].(error)
}
}
return ret0, ret1, ret2
}
func (mock *MockClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state string, description string, context string) error {
params := []pegomock.Param{repo, pull, state, description, context}
result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateStatus", 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 *MockClient) VerifyWasCalledOnce() *VerifierClient {
return &VerifierClient{mock, pegomock.Times(1), nil}
}
func (mock *MockClient) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierClient {
return &VerifierClient{mock, invocationCountMatcher, nil}
}
func (mock *MockClient) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierClient {
return &VerifierClient{mock, invocationCountMatcher, inOrderContext}
}
type VerifierClient struct {
mock *MockClient
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
}
func (verifier *VerifierClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) *Client_GetModifiedFiles_OngoingVerification {
params := []pegomock.Param{repo, pull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetModifiedFiles", params)
return &Client_GetModifiedFiles_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_GetModifiedFiles_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_GetModifiedFiles_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
repo, pull := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1]
}
func (c *Client_GetModifiedFiles_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(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)
}
}
return
}
func (verifier *VerifierClient) CreateComment(repo models.Repo, pull models.PullRequest, comment string) *Client_CreateComment_OngoingVerification {
params := []pegomock.Param{repo, pull, comment}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CreateComment", params)
return &Client_CreateComment_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_CreateComment_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_CreateComment_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
repo, pull, comment := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1], comment[len(comment)-1]
}
func (c *Client_CreateComment_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
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([]string, len(params[2]))
for u, param := range params[2] {
_param2[u] = param.(string)
}
}
return
}
func (verifier *VerifierClient) PullIsApproved(repo models.Repo, pull models.PullRequest) *Client_PullIsApproved_OngoingVerification {
params := []pegomock.Param{repo, pull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PullIsApproved", params)
return &Client_PullIsApproved_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_PullIsApproved_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_PullIsApproved_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
repo, pull := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1]
}
func (c *Client_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(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)
}
}
return
}
func (verifier *VerifierClient) GetPullRequest(repo models.Repo, num int) *Client_GetPullRequest_OngoingVerification {
params := []pegomock.Param{repo, num}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetPullRequest", params)
return &Client_GetPullRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_GetPullRequest_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_GetPullRequest_OngoingVerification) GetCapturedArguments() (models.Repo, int) {
repo, num := c.GetAllCapturedArguments()
return repo[len(repo)-1], num[len(num)-1]
}
func (c *Client_GetPullRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []int) {
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([]int, len(params[1]))
for u, param := range params[1] {
_param1[u] = param.(int)
}
}
return
}
func (verifier *VerifierClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state string, description string, context string) *Client_UpdateStatus_OngoingVerification {
params := []pegomock.Param{repo, pull, state, description, context}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateStatus", params)
return &Client_UpdateStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_UpdateStatus_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_UpdateStatus_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string, string, string) {
repo, pull, state, description, context := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1], state[len(state)-1], description[len(description)-1], context[len(context)-1]
}
func (c *Client_UpdateStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string, _param3 []string, _param4 []string) {
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([]string, len(params[2]))
for u, param := range params[2] {
_param2[u] = param.(string)
}
_param3 = make([]string, len(params[3]))
for u, param := range params[3] {
_param3[u] = param.(string)
}
_param4 = make([]string, len(params[4]))
for u, param := range params[4] {
_param4[u] = param.(string)
}
}
return
}