-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Thanks to @nicholas-wu-hs !
- Loading branch information
Showing
17 changed files
with
1,144 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Automatically generated by pegomock. DO NOT EDIT! | ||
// Source: github.com/hootsuite/atlantis/server/events/webhooks (interfaces: Sender) | ||
|
||
package mocks | ||
|
||
import ( | ||
"reflect" | ||
|
||
webhooks "github.com/hootsuite/atlantis/server/events/webhooks" | ||
logging "github.com/hootsuite/atlantis/server/logging" | ||
pegomock "github.com/petergtz/pegomock" | ||
) | ||
|
||
type MockSender struct { | ||
fail func(message string, callerSkip ...int) | ||
} | ||
|
||
func NewMockSender() *MockSender { | ||
return &MockSender{fail: pegomock.GlobalFailHandler} | ||
} | ||
|
||
func (mock *MockSender) Send(log *logging.SimpleLogger, applyResult webhooks.ApplyResult) error { | ||
params := []pegomock.Param{log, applyResult} | ||
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 *MockSender) VerifyWasCalledOnce() *VerifierSender { | ||
return &VerifierSender{mock, pegomock.Times(1), nil} | ||
} | ||
|
||
func (mock *MockSender) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierSender { | ||
return &VerifierSender{mock, invocationCountMatcher, nil} | ||
} | ||
|
||
func (mock *MockSender) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierSender { | ||
return &VerifierSender{mock, invocationCountMatcher, inOrderContext} | ||
} | ||
|
||
type VerifierSender struct { | ||
mock *MockSender | ||
invocationCountMatcher pegomock.Matcher | ||
inOrderContext *pegomock.InOrderContext | ||
} | ||
|
||
func (verifier *VerifierSender) Send(log *logging.SimpleLogger, applyResult webhooks.ApplyResult) *Sender_Send_OngoingVerification { | ||
params := []pegomock.Param{log, applyResult} | ||
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Send", params) | ||
return &Sender_Send_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} | ||
} | ||
|
||
type Sender_Send_OngoingVerification struct { | ||
mock *MockSender | ||
methodInvocations []pegomock.MethodInvocation | ||
} | ||
|
||
func (c *Sender_Send_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, webhooks.ApplyResult) { | ||
log, applyResult := c.GetAllCapturedArguments() | ||
return log[len(log)-1], applyResult[len(applyResult)-1] | ||
} | ||
|
||
func (c *Sender_Send_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []webhooks.ApplyResult) { | ||
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations) | ||
if len(params) > 0 { | ||
_param0 = make([]*logging.SimpleLogger, len(params[0])) | ||
for u, param := range params[0] { | ||
_param0[u] = param.(*logging.SimpleLogger) | ||
} | ||
_param1 = make([]webhooks.ApplyResult, len(params[1])) | ||
for u, param := range params[1] { | ||
_param1[u] = param.(webhooks.ApplyResult) | ||
} | ||
} | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
// Automatically generated by pegomock. DO NOT EDIT! | ||
// Source: github.com/hootsuite/atlantis/server/events/webhooks (interfaces: SlackClient) | ||
|
||
package mocks | ||
|
||
import ( | ||
"reflect" | ||
|
||
webhooks "github.com/hootsuite/atlantis/server/events/webhooks" | ||
pegomock "github.com/petergtz/pegomock" | ||
) | ||
|
||
type MockSlackClient struct { | ||
fail func(message string, callerSkip ...int) | ||
} | ||
|
||
func NewMockSlackClient() *MockSlackClient { | ||
return &MockSlackClient{fail: pegomock.GlobalFailHandler} | ||
} | ||
|
||
func (mock *MockSlackClient) AuthTest() error { | ||
params := []pegomock.Param{} | ||
result := pegomock.GetGenericMockFrom(mock).Invoke("AuthTest", 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 *MockSlackClient) TokenIsSet() bool { | ||
params := []pegomock.Param{} | ||
result := pegomock.GetGenericMockFrom(mock).Invoke("TokenIsSet", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem()}) | ||
var ret0 bool | ||
if len(result) != 0 { | ||
if result[0] != nil { | ||
ret0 = result[0].(bool) | ||
} | ||
} | ||
return ret0 | ||
} | ||
|
||
func (mock *MockSlackClient) ChannelExists(channelName string) (bool, error) { | ||
params := []pegomock.Param{channelName} | ||
result := pegomock.GetGenericMockFrom(mock).Invoke("ChannelExists", 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 *MockSlackClient) PostMessage(channel string, applyResult webhooks.ApplyResult) error { | ||
params := []pegomock.Param{channel, applyResult} | ||
result := pegomock.GetGenericMockFrom(mock).Invoke("PostMessage", 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 *MockSlackClient) VerifyWasCalledOnce() *VerifierSlackClient { | ||
return &VerifierSlackClient{mock, pegomock.Times(1), nil} | ||
} | ||
|
||
func (mock *MockSlackClient) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierSlackClient { | ||
return &VerifierSlackClient{mock, invocationCountMatcher, nil} | ||
} | ||
|
||
func (mock *MockSlackClient) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierSlackClient { | ||
return &VerifierSlackClient{mock, invocationCountMatcher, inOrderContext} | ||
} | ||
|
||
type VerifierSlackClient struct { | ||
mock *MockSlackClient | ||
invocationCountMatcher pegomock.Matcher | ||
inOrderContext *pegomock.InOrderContext | ||
} | ||
|
||
func (verifier *VerifierSlackClient) AuthTest() *SlackClient_AuthTest_OngoingVerification { | ||
params := []pegomock.Param{} | ||
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "AuthTest", params) | ||
return &SlackClient_AuthTest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} | ||
} | ||
|
||
type SlackClient_AuthTest_OngoingVerification struct { | ||
mock *MockSlackClient | ||
methodInvocations []pegomock.MethodInvocation | ||
} | ||
|
||
func (c *SlackClient_AuthTest_OngoingVerification) GetCapturedArguments() { | ||
} | ||
|
||
func (c *SlackClient_AuthTest_OngoingVerification) GetAllCapturedArguments() { | ||
} | ||
|
||
func (verifier *VerifierSlackClient) TokenIsSet() *SlackClient_TokenIsSet_OngoingVerification { | ||
params := []pegomock.Param{} | ||
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TokenIsSet", params) | ||
return &SlackClient_TokenIsSet_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} | ||
} | ||
|
||
type SlackClient_TokenIsSet_OngoingVerification struct { | ||
mock *MockSlackClient | ||
methodInvocations []pegomock.MethodInvocation | ||
} | ||
|
||
func (c *SlackClient_TokenIsSet_OngoingVerification) GetCapturedArguments() { | ||
} | ||
|
||
func (c *SlackClient_TokenIsSet_OngoingVerification) GetAllCapturedArguments() { | ||
} | ||
|
||
func (verifier *VerifierSlackClient) ChannelExists(channelName string) *SlackClient_ChannelExists_OngoingVerification { | ||
params := []pegomock.Param{channelName} | ||
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ChannelExists", params) | ||
return &SlackClient_ChannelExists_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} | ||
} | ||
|
||
type SlackClient_ChannelExists_OngoingVerification struct { | ||
mock *MockSlackClient | ||
methodInvocations []pegomock.MethodInvocation | ||
} | ||
|
||
func (c *SlackClient_ChannelExists_OngoingVerification) GetCapturedArguments() string { | ||
channelName := c.GetAllCapturedArguments() | ||
return channelName[len(channelName)-1] | ||
} | ||
|
||
func (c *SlackClient_ChannelExists_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { | ||
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations) | ||
if len(params) > 0 { | ||
_param0 = make([]string, len(params[0])) | ||
for u, param := range params[0] { | ||
_param0[u] = param.(string) | ||
} | ||
} | ||
return | ||
} | ||
|
||
func (verifier *VerifierSlackClient) PostMessage(channel string, applyResult webhooks.ApplyResult) *SlackClient_PostMessage_OngoingVerification { | ||
params := []pegomock.Param{channel, applyResult} | ||
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PostMessage", params) | ||
return &SlackClient_PostMessage_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} | ||
} | ||
|
||
type SlackClient_PostMessage_OngoingVerification struct { | ||
mock *MockSlackClient | ||
methodInvocations []pegomock.MethodInvocation | ||
} | ||
|
||
func (c *SlackClient_PostMessage_OngoingVerification) GetCapturedArguments() (string, webhooks.ApplyResult) { | ||
channel, applyResult := c.GetAllCapturedArguments() | ||
return channel[len(channel)-1], applyResult[len(applyResult)-1] | ||
} | ||
|
||
func (c *SlackClient_PostMessage_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []webhooks.ApplyResult) { | ||
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations) | ||
if len(params) > 0 { | ||
_param0 = make([]string, len(params[0])) | ||
for u, param := range params[0] { | ||
_param0[u] = param.(string) | ||
} | ||
_param1 = make([]webhooks.ApplyResult, len(params[1])) | ||
for u, param := range params[1] { | ||
_param1[u] = param.(webhooks.ApplyResult) | ||
} | ||
} | ||
return | ||
} |
Oops, something went wrong.