| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362 |
- package http
- import (
- "context"
- "net/mail"
- "github.com/stretchr/testify/mock"
- "github.com/mk6i/open-oscar-server/state"
- "github.com/mk6i/open-oscar-server/wire"
- )
- type mockParams struct {
- accountManagerParams
- bartAssetManagerParams
- buddyBroadcasterParams
- chatRoomDeleterParams
- chatRoomRetrieverParams
- chatSessionRetrieverParams
- directoryManagerParams
- feedBagRetrieverParams
- feedbagManagerParams
- messageRelayerParams
- profileRetrieverParams
- sessionRetrieverParams
- userManagerParams
- }
- // accountManagerParams is a helper struct that contains mock parameters for
- // accountManager methods
- type accountManagerParams struct {
- EmailAddressParams
- RegStatusParams
- ConfirmStatusParams
- updateSuspendedStatusParams
- setBotStatusParams
- }
- // EmailAddressParams is the list of parameters passed at the mock
- // accountManager.EmailAddress call site
- type EmailAddressParams []struct {
- screenName state.IdentScreenName
- result *mail.Address
- err error
- }
- // RegStatusParams is the list of parameters passed at the mock
- // accountManager.RegStatus call site
- type RegStatusParams []struct {
- screenName state.IdentScreenName
- result uint16
- err error
- }
- // ConfirmStatusParams is the list of parameters passed at the mock
- // accountManager.ConfirmStatus call site
- type ConfirmStatusParams []struct {
- screenName state.IdentScreenName
- result bool
- err error
- }
- // updateSuspendedStatus is the list of parameters passed at the mock
- // accountManager.updateSuspendedStatus call site
- type updateSuspendedStatusParams []struct {
- suspendedStatus uint16
- screenName state.IdentScreenName
- err error
- }
- // setBotStatusParams is the list of parameters passed at the mock
- // accountManager.SetBotStatus call site
- type setBotStatusParams []struct {
- isBot bool
- screenName state.IdentScreenName
- err error
- }
- // bartAssetManagerParams is a helper struct that contains mock parameters for
- // BARTAssetManager methods
- type bartAssetManagerParams struct {
- bartItemParams
- insertBARTItemParams
- listBARTItemsParams
- deleteBARTItemParams
- }
- // bartItemParams is the list of parameters passed at the mock
- // BARTAssetManager.BARTItem call site
- type bartItemParams []struct {
- hash []byte
- result []byte
- err error
- }
- // insertBARTItemParams is the list of parameters passed at the mock
- // BARTAssetManager.InsertBARTItem call site
- type insertBARTItemParams []struct {
- hash []byte
- blob []byte
- itemType uint16
- err error
- }
- // listBARTItemsParams is the list of parameters passed at the mock
- // BARTAssetManager.ListBARTItems call site
- type listBARTItemsParams []struct {
- itemType uint16
- result []state.BARTItem
- err error
- }
- // deleteBARTItemParams is the list of parameters passed at the mock
- // BARTAssetManager.DeleteBARTItem call site
- type deleteBARTItemParams []struct {
- hash []byte
- err error
- }
- // buddyBroadcasterParams is a helper struct that contains mock parameters for
- // BuddyBroadcaster methods
- type buddyBroadcasterParams struct {
- broadcastVisibilityParams
- }
- // broadcastVisibilityParams is the list of parameters passed at the mock
- // BuddyBroadcaster.BroadcastVisibility call site
- type broadcastVisibilityParams []struct {
- you *state.SessionInstance
- filter []state.IdentScreenName
- sendDepartures bool
- err error
- }
- // chatRoomRetrieverParams is a helper struct that contains mock parameters for
- // ChatRoomRetriever methods
- type chatRoomRetrieverParams struct {
- allChatRoomsParams
- }
- // allChatRoomsParams is the list of parameters passed at the mock
- // ChatRoomRetriever.AllChatRooms call site
- type allChatRoomsParams []struct {
- exchange uint16
- result []state.ChatRoom
- err error
- }
- // chatRoomDeleterParams is a helper struct that contains mock parameters for
- // ChatRoomDeleter methods
- type chatRoomDeleterParams struct {
- deleteChatRoomsParams
- }
- // deleteChatRoomsParams is the list of parameters passed at the mock
- // ChatRoomDeleter.DeleteChatRooms call site
- type deleteChatRoomsParams []struct {
- exchange uint16
- names []string
- err error
- }
- // chatSessionRetrieverParams is a helper struct that contains mock parameters for
- // ChatSessionRetriever methods
- type chatSessionRetrieverParams struct {
- chatSessionRetrieverAllSessionsParams
- }
- // chatSessionRetrieverAllSessionsParams is the list of parameters passed at the mock
- // ChatSessionRetriever.AllSessions call site
- type chatSessionRetrieverAllSessionsParams []struct {
- cookie string
- result []*state.Session
- }
- type directoryManagerParams struct {
- categoriesParams
- createCategoryParams
- createKeywordParams
- deleteCategoryParams
- deleteKeywordParams
- keywordsByCategoryParams
- }
- // categoriesParams is the list of parameters passed at the mock
- // DirectoryManager.Categories call site
- type categoriesParams []struct {
- result []state.Category
- err error
- }
- // createCategoryParams is the list of parameters passed at the mock
- // DirectoryManager.CreateCategory call site
- type createCategoryParams []struct {
- name string
- result state.Category
- err error
- }
- // createKeywordParams is the list of parameters passed at the mock
- // DirectoryManager.CreateKeyword call site
- type createKeywordParams []struct {
- name string
- categoryID uint8
- result state.Keyword
- err error
- }
- // deleteCategoryParams is the list of parameters passed at the mock
- // DirectoryManager.DeleteCategory call site
- type deleteCategoryParams []struct {
- categoryID uint8
- err error
- }
- // deleteKeywordParams is the list of parameters passed at the mock
- // DirectoryManager.DeleteKeyword call site
- type deleteKeywordParams []struct {
- id uint8
- err error
- }
- // keywordsByCategoryParams is the list of parameters passed at the mock
- // DirectoryManager.KeywordsByCategory call site
- type keywordsByCategoryParams []struct {
- categoryID uint8
- result []state.Keyword
- err error
- }
- // feedBagRetrieverParams is a helper struct that contains mock parameters for
- // FeedBagRetriever methods
- type feedBagRetrieverParams struct {
- buddyIconMetadataParams
- }
- // buddyIconMetadataParams is the list of parameters passed at the mock
- // FeedBagRetriever.BuddyIconMetadataParams call site
- type buddyIconMetadataParams []struct {
- screenName state.IdentScreenName
- result *wire.BARTID
- err error
- }
- // feedbagManagerParams is a helper struct that contains mock parameters for
- // FeedbagManager methods
- type feedbagManagerParams struct {
- feedbagParams
- feedbagUpsertParams
- feedbagDeleteParams
- }
- // feedbagParams is the list of parameters passed at the mock
- // FeedbagManager.Feedbag call site
- type feedbagParams []struct {
- screenName state.IdentScreenName
- result []wire.FeedbagItem
- err error
- }
- // feedbagUpsertParams is the list of parameters passed at the mock
- // FeedbagManager.FeedbagUpsert call site
- type feedbagUpsertParams []struct {
- screenName state.IdentScreenName
- items []wire.FeedbagItem
- err error
- }
- // feedbagDeleteParams is the list of parameters passed at the mock
- // FeedbagManager.FeedbagDelete call site
- type feedbagDeleteParams []struct {
- screenName state.IdentScreenName
- items []wire.FeedbagItem
- err error
- }
- // messageRelayerParams is a helper struct that contains mock parameters for
- // MessageRelayer methods
- type messageRelayerParams struct {
- relayToScreenNameParams
- }
- // relayToScreenNameParams is the list of parameters passed at the mock
- // MessageRelayer.RelayToScreenName call site
- type relayToScreenNameParams []struct {
- screenName state.IdentScreenName
- msg wire.SNACMessage
- }
- // profileRetrieverParams is a helper struct that contains mock parameters for
- // ProfileRetriever methods
- type profileRetrieverParams struct {
- retrieveProfileParams
- }
- // retrieveProfileParams is the list of parameters passed at the mock
- // ProfileRetriever.Profile call site
- type retrieveProfileParams []struct {
- screenName state.IdentScreenName
- result state.UserProfile
- err error
- }
- // sessionRetrieverParams is a helper struct that contains mock parameters for
- // SessionRetriever methods
- type sessionRetrieverParams struct {
- retrieveSessionByNameParams
- }
- // retrieveSessionByNameParams is the list of parameters passed at the mock
- // SessionRetriever.RetrieveSession call site
- type retrieveSessionByNameParams []struct {
- screenName state.IdentScreenName
- result *state.Session
- }
- // userManagerParams is a helper struct that contains mock parameters for
- // UserManager methods
- type userManagerParams struct {
- allUsersParams
- deleteUserParams
- getUserParams
- setUserPasswordParams
- }
- // allUsersParams is the list of parameters passed at the mock
- // UserManager.AllUsers call site
- type allUsersParams []struct {
- result []state.User
- err error
- }
- // deleteUserParams is the list of parameters passed at the mock
- // UserManager.DeleteUser call site
- type deleteUserParams []struct {
- screenName state.IdentScreenName
- err error
- }
- // getUserParams is the list of parameters passed at the mock
- // UserManager.User call site
- type getUserParams []struct {
- screenName state.IdentScreenName
- result *state.User
- err error
- }
- // setUserPasswordParams is the list of parameters passed at the mock
- // UserManager.SetUserPassword call site
- type setUserPasswordParams []struct {
- screenName state.IdentScreenName
- newPassword string
- err error
- }
- // matchContext matches any instance of Context interface.
- func matchContext() interface{} {
- return mock.MatchedBy(func(ctx any) bool {
- _, ok := ctx.(context.Context)
- return ok
- })
- }
|