Documentation
¶
Index ¶
- type BotMock
- func (mock *BotMock) AddApprovedUsers(id int64, ids ...int64)
- func (mock *BotMock) AddApprovedUsersCalls() []struct{ ... }
- func (mock *BotMock) OnMessage(msg bot.Message) bot.Response
- func (mock *BotMock) OnMessageCalls() []struct{ ... }
- func (mock *BotMock) RemoveApprovedUsers(id int64, ids ...int64)
- func (mock *BotMock) RemoveApprovedUsersCalls() []struct{ ... }
- func (mock *BotMock) ResetAddApprovedUsersCalls()
- func (mock *BotMock) ResetCalls()
- func (mock *BotMock) ResetOnMessageCalls()
- func (mock *BotMock) ResetRemoveApprovedUsersCalls()
- 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 SpamWebMock
- 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 { // AddApprovedUsersFunc mocks the AddApprovedUsers method. AddApprovedUsersFunc func(id int64, ids ...int64) // OnMessageFunc mocks the OnMessage method. OnMessageFunc func(msg bot.Message) bot.Response // RemoveApprovedUsersFunc mocks the RemoveApprovedUsers method. RemoveApprovedUsersFunc func(id int64, ids ...int64) // 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{ AddApprovedUsersFunc: func(id int64, ids ...int64) { panic("mock out the AddApprovedUsers method") }, OnMessageFunc: func(msg bot.Message) bot.Response { panic("mock out the OnMessage method") }, RemoveApprovedUsersFunc: func(id int64, ids ...int64) { panic("mock out the RemoveApprovedUsers 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) AddApprovedUsers ¶ added in v1.1.0
AddApprovedUsers calls AddApprovedUsersFunc.
func (*BotMock) AddApprovedUsersCalls ¶ added in v1.1.0
AddApprovedUsersCalls gets all the calls that were made to AddApprovedUsers. Check the length with:
len(mockedBot.AddApprovedUsersCalls())
func (*BotMock) OnMessageCalls ¶
OnMessageCalls gets all the calls that were made to OnMessage. Check the length with:
len(mockedBot.OnMessageCalls())
func (*BotMock) RemoveApprovedUsers ¶ added in v1.2.3
RemoveApprovedUsers calls RemoveApprovedUsersFunc.
func (*BotMock) RemoveApprovedUsersCalls ¶ added in v1.2.3
RemoveApprovedUsersCalls gets all the calls that were made to RemoveApprovedUsers. Check the length with:
len(mockedBot.RemoveApprovedUsersCalls())
func (*BotMock) ResetAddApprovedUsersCalls ¶ added in v1.1.0
func (mock *BotMock) ResetAddApprovedUsersCalls()
ResetAddApprovedUsersCalls reset all the calls that were made to AddApprovedUsers.
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.
func (*BotMock) ResetRemoveApprovedUsersCalls ¶ added in v1.2.3
func (mock *BotMock) ResetRemoveApprovedUsersCalls()
ResetRemoveApprovedUsersCalls reset all the calls that were made to RemoveApprovedUsers.
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 SpamWebMock ¶ added in v0.2.0
type SpamWebMock struct { // UnbanURLFunc mocks the UnbanURL method. UnbanURLFunc func(userID int64, msg string) string // contains filtered or unexported fields }
SpamWebMock is a mock implementation of events.SpamWeb.
func TestSomethingThatUsesSpamWeb(t *testing.T) { // make and configure a mocked events.SpamWeb mockedSpamWeb := &SpamWebMock{ UnbanURLFunc: func(userID int64, msg string) string { panic("mock out the UnbanURL method") }, } // use mockedSpamWeb in code that requires events.SpamWeb // and then make assertions. }
func (*SpamWebMock) ResetCalls ¶ added in v0.2.0
func (mock *SpamWebMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*SpamWebMock) ResetUnbanURLCalls ¶ added in v0.2.0
func (mock *SpamWebMock) ResetUnbanURLCalls()
ResetUnbanURLCalls reset all the calls that were made to UnbanURL.
func (*SpamWebMock) UnbanURL ¶ added in v0.2.0
func (mock *SpamWebMock) UnbanURL(userID int64, msg string) string
UnbanURL calls UnbanURLFunc.
func (*SpamWebMock) UnbanURLCalls ¶ added in v0.2.0
func (mock *SpamWebMock) UnbanURLCalls() []struct { UserID int64 Msg string }
UnbanURLCalls gets all the calls that were made to UnbanURL. Check the length with:
len(mockedSpamWeb.UnbanURLCalls())
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.