This commit is contained in:
@@ -27,9 +27,11 @@ func TestInboundCreatesSiteReply(t *testing.T) {
|
||||
links := newMemoryLinks()
|
||||
api := &fakeAPI{}
|
||||
mailer := &mail.Recording{}
|
||||
bot := inboundTestBot(mem, links, api, mailer, admin.Username)
|
||||
bot := inboundTestBot(mem, links, api, admin.Username)
|
||||
bus := events.New()
|
||||
defer bus.Close()
|
||||
bot.bus = bus
|
||||
mail.Subscribe(bus, mem, mailer)
|
||||
bus.Subscribe(bot.Handle)
|
||||
root := seedLinkedRoot(t, mem, links, homeowner.ID, "thread-1")
|
||||
|
||||
@@ -68,7 +70,7 @@ func TestInboundParentsFromReference(t *testing.T) {
|
||||
|
||||
mem, homeowner, admin := seedInboundUsers(t)
|
||||
links := newMemoryLinks()
|
||||
bot := inboundTestBot(mem, links, &fakeAPI{}, &mail.Recording{}, admin.Username)
|
||||
bot := inboundTestBot(mem, links, &fakeAPI{}, admin.Username)
|
||||
root := seedLinkedRoot(t, mem, links, homeowner.ID, "thread-1")
|
||||
plumberReply := &store.Post{ParentID: &root.ID, AuthorID: admin.ID, Body: "First look."}
|
||||
if err := mem.CreatePost(context.Background(), plumberReply); err != nil {
|
||||
@@ -106,7 +108,7 @@ func TestInboundIgnoresAllowlistHiddenAndEchoSources(t *testing.T) {
|
||||
mem, homeowner, admin := seedInboundUsers(t)
|
||||
links := newMemoryLinks()
|
||||
api := &fakeAPI{}
|
||||
bot := inboundTestBot(mem, links, api, mail.Nop{}, admin.Username)
|
||||
bot := inboundTestBot(mem, links, api, admin.Username)
|
||||
root := seedLinkedRoot(t, mem, links, homeowner.ID, "thread-1")
|
||||
hidden := &store.Post{
|
||||
AuthorID: homeowner.ID,
|
||||
@@ -148,10 +150,9 @@ func TestInboundIgnoresAllowlistHiddenAndEchoSources(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func inboundTestBot(mem *store.Memory, links *memoryLinks, api *fakeAPI, mailer mail.Notifier, adminUsername string) *Bot {
|
||||
func inboundTestBot(mem *store.Memory, links *memoryLinks, api *fakeAPI, adminUsername string) *Bot {
|
||||
bot := New("channel-1", links, api)
|
||||
bot.store = mem
|
||||
bot.mail = mailer
|
||||
bot.admins = map[string]string{"snow-admin": adminUsername}
|
||||
bot.botUserID = "bot-1"
|
||||
return bot
|
||||
|
||||
Reference in New Issue
Block a user