mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-01-07 04:27:18 +00:00
bot: Fix failing ./extras/middlewares test
This commit is contained in:
parent
d9681ea1d1
commit
ff709fc16c
|
@ -168,6 +168,7 @@ type mockStore struct {
|
||||||
|
|
||||||
func mockCabinet() *store.Cabinet {
|
func mockCabinet() *store.Cabinet {
|
||||||
c := *store.NoopCabinet
|
c := *store.NoopCabinet
|
||||||
|
c.RoleStore = &mockStore{}
|
||||||
c.GuildStore = &mockStore{}
|
c.GuildStore = &mockStore{}
|
||||||
c.MemberStore = &mockStore{}
|
c.MemberStore = &mockStore{}
|
||||||
c.ChannelStore = &mockStore{}
|
c.ChannelStore = &mockStore{}
|
||||||
|
@ -178,13 +179,28 @@ func mockCabinet() *store.Cabinet {
|
||||||
func (s *mockStore) Guild(id discord.GuildID) (*discord.Guild, error) {
|
func (s *mockStore) Guild(id discord.GuildID) (*discord.Guild, error) {
|
||||||
return &discord.Guild{
|
return &discord.Guild{
|
||||||
ID: id,
|
ID: id,
|
||||||
Roles: []discord.Role{{
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *mockStore) Roles(id discord.GuildID) ([]discord.Role, error) {
|
||||||
|
return []discord.Role{
|
||||||
|
{
|
||||||
ID: 69420,
|
ID: 69420,
|
||||||
Permissions: discord.PermissionAdministrator,
|
Permissions: discord.PermissionAdministrator,
|
||||||
}},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *mockStore) Role(_ discord.GuildID, roleID discord.RoleID) (*discord.Role, error) {
|
||||||
|
if roleID == 69420 {
|
||||||
|
return &discord.Role{
|
||||||
|
ID: roleID,
|
||||||
|
Permissions: discord.PermissionAdministrator,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
return nil, store.ErrNotFound
|
||||||
|
}
|
||||||
|
|
||||||
func (s *mockStore) Member(_ discord.GuildID, userID discord.UserID) (*discord.Member, error) {
|
func (s *mockStore) Member(_ discord.GuildID, userID discord.UserID) (*discord.Member, error) {
|
||||||
return &discord.Member{
|
return &discord.Member{
|
||||||
User: discord.User{ID: userID},
|
User: discord.User{ID: userID},
|
||||||
|
|
Loading…
Reference in a new issue