Documentation
¶
Index ¶
- type BotMock
- func (mock *BotMock) AddApprovedUser(id int64, name string) error
- func (mock *BotMock) AddApprovedUserCalls() []struct{ ... }
- func (mock *BotMock) IsApprovedUser(userID int64) bool
- func (mock *BotMock) IsApprovedUserCalls() []struct{ ... }
- func (mock *BotMock) OnMessage(msg bot.Message) bot.Response
- func (mock *BotMock) OnMessageCalls() []struct{ ... }
- func (mock *BotMock) RemoveApprovedUser(id int64) error
- func (mock *BotMock) RemoveApprovedUserCalls() []struct{ ... }
- func (mock *BotMock) ResetAddApprovedUserCalls()
- func (mock *BotMock) ResetCalls()
- func (mock *BotMock) ResetIsApprovedUserCalls()
- func (mock *BotMock) ResetOnMessageCalls()
- func (mock *BotMock) ResetRemoveApprovedUserCalls()
- func (mock *BotMock) ResetUpdateHamCalls()
- func (mock *BotMock) ResetUpdateSpamCalls()
- func (mock *BotMock) UpdateHam(msg string) error
- func (mock *BotMock) UpdateHamCalls() []struct{ ... }
- func (mock *BotMock) UpdateSpam(msg string) error
- func (mock *BotMock) UpdateSpamCalls() []struct{ ... }
- type SpamLoggerMock
- type TbAPIMock
- func (mock *TbAPIMock) GetChat(config tbapi.ChatInfoConfig) (tbapi.Chat, error)
- func (mock *TbAPIMock) GetChatAdministrators(config tbapi.ChatAdministratorsConfig) ([]tbapi.ChatMember, error)
- func (mock *TbAPIMock) GetChatAdministratorsCalls() []struct{ ... }
- 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) ResetGetChatAdministratorsCalls()
- 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 { // AddApprovedUserFunc mocks the AddApprovedUser method. AddApprovedUserFunc func(id int64, name string) error // IsApprovedUserFunc mocks the IsApprovedUser method. IsApprovedUserFunc func(userID int64) bool // OnMessageFunc mocks the OnMessage method. OnMessageFunc func(msg bot.Message) bot.Response // RemoveApprovedUserFunc mocks the RemoveApprovedUser method. RemoveApprovedUserFunc func(id int64) error // UpdateHamFunc mocks the UpdateHam method. UpdateHamFunc func(msg string) error // UpdateSpamFunc mocks the UpdateSpam method. UpdateSpamFunc func(msg string) error // 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{ AddApprovedUserFunc: func(id int64, name string) error { panic("mock out the AddApprovedUser method") }, IsApprovedUserFunc: func(userID int64) bool { panic("mock out the IsApprovedUser method") }, OnMessageFunc: func(msg bot.Message) bot.Response { panic("mock out the OnMessage method") }, RemoveApprovedUserFunc: func(id int64) error { panic("mock out the RemoveApprovedUser method") }, UpdateHamFunc: func(msg string) error { panic("mock out the UpdateHam method") }, UpdateSpamFunc: func(msg string) error { panic("mock out the UpdateSpam method") }, } // use mockedBot in code that requires events.Bot // and then make assertions. }
func (*BotMock) AddApprovedUser ¶ added in v1.6.0
AddApprovedUser calls AddApprovedUserFunc.
func (*BotMock) AddApprovedUserCalls ¶ added in v1.6.0
AddApprovedUserCalls gets all the calls that were made to AddApprovedUser. Check the length with:
len(mockedBot.AddApprovedUserCalls())
func (*BotMock) IsApprovedUser ¶ added in v1.6.0
IsApprovedUser calls IsApprovedUserFunc.
func (*BotMock) IsApprovedUserCalls ¶ added in v1.6.0
IsApprovedUserCalls gets all the calls that were made to IsApprovedUser. Check the length with:
len(mockedBot.IsApprovedUserCalls())
func (*BotMock) OnMessageCalls ¶
OnMessageCalls gets all the calls that were made to OnMessage. Check the length with:
len(mockedBot.OnMessageCalls())
func (*BotMock) RemoveApprovedUser ¶ added in v1.6.0
RemoveApprovedUser calls RemoveApprovedUserFunc.
func (*BotMock) RemoveApprovedUserCalls ¶ added in v1.6.0
RemoveApprovedUserCalls gets all the calls that were made to RemoveApprovedUser. Check the length with:
len(mockedBot.RemoveApprovedUserCalls())
func (*BotMock) ResetAddApprovedUserCalls ¶ added in v1.6.0
func (mock *BotMock) ResetAddApprovedUserCalls()
ResetAddApprovedUserCalls reset all the calls that were made to AddApprovedUser.
func (*BotMock) ResetCalls ¶
func (mock *BotMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*BotMock) ResetIsApprovedUserCalls ¶ added in v1.6.0
func (mock *BotMock) ResetIsApprovedUserCalls()
ResetIsApprovedUserCalls reset all the calls that were made to IsApprovedUser.
func (*BotMock) ResetOnMessageCalls ¶
func (mock *BotMock) ResetOnMessageCalls()
ResetOnMessageCalls reset all the calls that were made to OnMessage.
func (*BotMock) ResetRemoveApprovedUserCalls ¶ added in v1.6.0
func (mock *BotMock) ResetRemoveApprovedUserCalls()
ResetRemoveApprovedUserCalls reset all the calls that were made to RemoveApprovedUser.
func (*BotMock) ResetUpdateHamCalls ¶ added in v0.2.0
func (mock *BotMock) ResetUpdateHamCalls()
ResetUpdateHamCalls reset all the calls that were made to UpdateHam.
func (*BotMock) ResetUpdateSpamCalls ¶ added in v0.2.0
func (mock *BotMock) ResetUpdateSpamCalls()
ResetUpdateSpamCalls reset all the calls that were made to UpdateSpam.
func (*BotMock) UpdateHamCalls ¶ added in v0.2.0
UpdateHamCalls gets all the calls that were made to UpdateHam. Check the length with:
len(mockedBot.UpdateHamCalls())
func (*BotMock) UpdateSpam ¶ added in v0.2.0
UpdateSpam calls UpdateSpamFunc.
func (*BotMock) UpdateSpamCalls ¶ added in v0.2.0
UpdateSpamCalls gets all the calls that were made to UpdateSpam. Check the length with:
len(mockedBot.UpdateSpamCalls())
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 TbAPIMock ¶
type TbAPIMock struct { // GetChatFunc mocks the GetChat method. GetChatFunc func(config tbapi.ChatInfoConfig) (tbapi.Chat, error) // GetChatAdministratorsFunc mocks the GetChatAdministrators method. GetChatAdministratorsFunc func(config tbapi.ChatAdministratorsConfig) ([]tbapi.ChatMember, 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") }, GetChatAdministratorsFunc: func(config tbapi.ChatAdministratorsConfig) ([]tbapi.ChatMember, error) { panic("mock out the GetChatAdministrators 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) GetChatAdministrators ¶ added in v1.1.0
func (mock *TbAPIMock) GetChatAdministrators(config tbapi.ChatAdministratorsConfig) ([]tbapi.ChatMember, error)
GetChatAdministrators calls GetChatAdministratorsFunc.
func (*TbAPIMock) GetChatAdministratorsCalls ¶ added in v1.1.0
func (mock *TbAPIMock) GetChatAdministratorsCalls() []struct { Config tbapi.ChatAdministratorsConfig }
GetChatAdministratorsCalls gets all the calls that were made to GetChatAdministrators. Check the length with:
len(mockedTbAPI.GetChatAdministratorsCalls())
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) ResetGetChatAdministratorsCalls ¶ added in v1.1.0
func (mock *TbAPIMock) ResetGetChatAdministratorsCalls()
ResetGetChatAdministratorsCalls reset all the calls that were made to GetChatAdministrators.
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.