Documentation
¶
Index ¶
- type BotMock
- type SpamLoggerMock
- type SpamRestMock
- type TbAPIMock
- func (mock *TbAPIMock) GetChat(config tbapi.ChatInfoConfig) (tbapi.Chat, error)
- func (mock *TbAPIMock) GetChatCalls() []struct{ ... }
- func (mock *TbAPIMock) GetUpdatesChan(config tbapi.UpdateConfig) tbapi.UpdatesChannel
- func (mock *TbAPIMock) GetUpdatesChanCalls() []struct{ ... }
- func (mock *TbAPIMock) Request(c tbapi.Chattable) (*tbapi.APIResponse, error)
- func (mock *TbAPIMock) RequestCalls() []struct{ ... }
- func (mock *TbAPIMock) ResetCalls()
- func (mock *TbAPIMock) ResetGetChatCalls()
- func (mock *TbAPIMock) ResetGetUpdatesChanCalls()
- func (mock *TbAPIMock) ResetRequestCalls()
- func (mock *TbAPIMock) ResetSendCalls()
- func (mock *TbAPIMock) Send(c tbapi.Chattable) (tbapi.Message, error)
- func (mock *TbAPIMock) SendCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BotMock ¶
type BotMock struct { // OnMessageFunc mocks the OnMessage method. OnMessageFunc func(msg bot.Message) bot.Response // contains filtered or unexported fields }
BotMock is a mock implementation of events.Bot.
func TestSomethingThatUsesBot(t *testing.T) { // make and configure a mocked events.Bot mockedBot := &BotMock{ OnMessageFunc: func(msg bot.Message) bot.Response { panic("mock out the OnMessage method") }, } // use mockedBot in code that requires events.Bot // and then make assertions. }
func (*BotMock) OnMessageCalls ¶
OnMessageCalls gets all the calls that were made to OnMessage. Check the length with:
len(mockedBot.OnMessageCalls())
func (*BotMock) ResetCalls ¶
func (mock *BotMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*BotMock) ResetOnMessageCalls ¶
func (mock *BotMock) ResetOnMessageCalls()
ResetOnMessageCalls reset all the calls that were made to OnMessage.
type SpamLoggerMock ¶
type SpamLoggerMock struct { // SaveFunc mocks the Save method. SaveFunc func(msg *bot.Message, response *bot.Response) // contains filtered or unexported fields }
SpamLoggerMock is a mock implementation of events.SpamLogger.
func TestSomethingThatUsesSpamLogger(t *testing.T) { // make and configure a mocked events.SpamLogger mockedSpamLogger := &SpamLoggerMock{ SaveFunc: func(msg *bot.Message, response *bot.Response) { panic("mock out the Save method") }, } // use mockedSpamLogger in code that requires events.SpamLogger // and then make assertions. }
func (*SpamLoggerMock) ResetCalls ¶
func (mock *SpamLoggerMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*SpamLoggerMock) ResetSaveCalls ¶
func (mock *SpamLoggerMock) ResetSaveCalls()
ResetSaveCalls reset all the calls that were made to Save.
type SpamRestMock ¶
type SpamRestMock struct { // UnbanURLFunc mocks the UnbanURL method. UnbanURLFunc func(userID int64) string // contains filtered or unexported fields }
SpamRestMock is a mock implementation of events.SpamWeb.
func TestSomethingThatUsesSpamRest(t *testing.T) { // make and configure a mocked events.SpamWeb mockedSpamRest := &SpamRestMock{ UnbanURLFunc: func(userID int64) string { panic("mock out the UnbanURL method") }, } // use mockedSpamRest in code that requires events.SpamWeb // and then make assertions. }
func (*SpamRestMock) ResetCalls ¶
func (mock *SpamRestMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*SpamRestMock) ResetUnbanURLCalls ¶
func (mock *SpamRestMock) ResetUnbanURLCalls()
ResetUnbanURLCalls reset all the calls that were made to UnbanURL.
func (*SpamRestMock) UnbanURL ¶
func (mock *SpamRestMock) UnbanURL(userID int64) string
UnbanURL calls UnbanURLFunc.
func (*SpamRestMock) UnbanURLCalls ¶
func (mock *SpamRestMock) UnbanURLCalls() []struct { UserID int64 }
UnbanURLCalls gets all the calls that were made to UnbanURL. Check the length with:
len(mockedSpamRest.UnbanURLCalls())
type TbAPIMock ¶
type TbAPIMock struct { // GetChatFunc mocks the GetChat method. GetChatFunc func(config tbapi.ChatInfoConfig) (tbapi.Chat, error) // GetUpdatesChanFunc mocks the GetUpdatesChan method. GetUpdatesChanFunc func(config tbapi.UpdateConfig) tbapi.UpdatesChannel // RequestFunc mocks the Request method. RequestFunc func(c tbapi.Chattable) (*tbapi.APIResponse, error) // SendFunc mocks the Send method. SendFunc func(c tbapi.Chattable) (tbapi.Message, error) // contains filtered or unexported fields }
TbAPIMock is a mock implementation of events.TbAPI.
func TestSomethingThatUsesTbAPI(t *testing.T) { // make and configure a mocked events.TbAPI mockedTbAPI := &TbAPIMock{ GetChatFunc: func(config tbapi.ChatInfoConfig) (tbapi.Chat, error) { panic("mock out the GetChat method") }, GetUpdatesChanFunc: func(config tbapi.UpdateConfig) tbapi.UpdatesChannel { panic("mock out the GetUpdatesChan method") }, RequestFunc: func(c tbapi.Chattable) (*tbapi.APIResponse, error) { panic("mock out the Request method") }, SendFunc: func(c tbapi.Chattable) (tbapi.Message, error) { panic("mock out the Send method") }, } // use mockedTbAPI in code that requires events.TbAPI // and then make assertions. }
func (*TbAPIMock) GetChatCalls ¶
func (mock *TbAPIMock) GetChatCalls() []struct { Config tbapi.ChatInfoConfig }
GetChatCalls gets all the calls that were made to GetChat. Check the length with:
len(mockedTbAPI.GetChatCalls())
func (*TbAPIMock) GetUpdatesChan ¶
func (mock *TbAPIMock) GetUpdatesChan(config tbapi.UpdateConfig) tbapi.UpdatesChannel
GetUpdatesChan calls GetUpdatesChanFunc.
func (*TbAPIMock) GetUpdatesChanCalls ¶
func (mock *TbAPIMock) GetUpdatesChanCalls() []struct { Config tbapi.UpdateConfig }
GetUpdatesChanCalls gets all the calls that were made to GetUpdatesChan. Check the length with:
len(mockedTbAPI.GetUpdatesChanCalls())
func (*TbAPIMock) RequestCalls ¶
RequestCalls gets all the calls that were made to Request. Check the length with:
len(mockedTbAPI.RequestCalls())
func (*TbAPIMock) ResetCalls ¶
func (mock *TbAPIMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*TbAPIMock) ResetGetChatCalls ¶
func (mock *TbAPIMock) ResetGetChatCalls()
ResetGetChatCalls reset all the calls that were made to GetChat.
func (*TbAPIMock) ResetGetUpdatesChanCalls ¶
func (mock *TbAPIMock) ResetGetUpdatesChanCalls()
ResetGetUpdatesChanCalls reset all the calls that were made to GetUpdatesChan.
func (*TbAPIMock) ResetRequestCalls ¶
func (mock *TbAPIMock) ResetRequestCalls()
ResetRequestCalls reset all the calls that were made to Request.
func (*TbAPIMock) ResetSendCalls ¶
func (mock *TbAPIMock) ResetSendCalls()
ResetSendCalls reset all the calls that were made to Send.