mirror of https://github.com/velour/catbase.git
cli: finish removing references from tests
This commit is contained in:
parent
a5e919733c
commit
b20da607bc
|
@ -5,8 +5,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/velour/catbase/bot"
|
||||
"github.com/velour/catbase/bot/msg"
|
||||
|
@ -34,10 +32,8 @@ func makeMessage(payload string, r *regexp.Regexp) bot.Request {
|
|||
if isCmd {
|
||||
payload = payload[1:]
|
||||
}
|
||||
c := cli.CliPlugin{}
|
||||
values := bot.ParseValues(r, payload)
|
||||
return bot.Request{
|
||||
Conn: &c,
|
||||
Kind: bot.Message,
|
||||
Values: values,
|
||||
Msg: msg.Message{
|
||||
|
|
|
@ -7,8 +7,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/velour/catbase/bot"
|
||||
"github.com/velour/catbase/bot/msg"
|
||||
|
@ -16,13 +14,11 @@ import (
|
|||
)
|
||||
|
||||
func makeMessage(payload string, r *regexp.Regexp) bot.Request {
|
||||
c := &cli.CliPlugin{}
|
||||
isCmd := strings.HasPrefix(payload, "!")
|
||||
if isCmd {
|
||||
payload = payload[1:]
|
||||
}
|
||||
return bot.Request{
|
||||
Conn: c,
|
||||
Kind: bot.Message,
|
||||
Values: bot.ParseValues(r, payload),
|
||||
Msg: msg.Message{
|
||||
|
@ -272,7 +268,6 @@ func TestHelp(t *testing.T) {
|
|||
mb := bot.NewMockBot()
|
||||
bp := newBabblerPlugin(mb)
|
||||
assert.NotNil(t, bp)
|
||||
c := &cli.CliPlugin{}
|
||||
bp.help(c, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
bp.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
assert.Len(t, mb.Messages, 1)
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/velour/catbase/bot"
|
||||
"github.com/velour/catbase/bot/msg"
|
||||
|
@ -21,10 +19,8 @@ func makeMessage(payload string, r *regexp.Regexp) bot.Request {
|
|||
if isCmd {
|
||||
payload = payload[1:]
|
||||
}
|
||||
c := &cli.CliPlugin{}
|
||||
values := bot.ParseValues(r, payload)
|
||||
return bot.Request{
|
||||
Conn: c,
|
||||
Kind: bot.Message,
|
||||
Values: values,
|
||||
Msg: msg.Message{
|
||||
|
@ -136,6 +132,6 @@ func TestBeersReport(t *testing.T) {
|
|||
|
||||
func TestHelp(t *testing.T) {
|
||||
b, mb := makeBeersPlugin(t)
|
||||
b.help(&cli.CliPlugin{}, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
b.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
assert.Len(t, mb.Messages, 1)
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/velour/catbase/bot"
|
||||
|
@ -21,7 +19,6 @@ func makeMessage(payload string) bot.Request {
|
|||
payload = payload[1:]
|
||||
}
|
||||
return bot.Request{
|
||||
Conn: &cli.CliPlugin{},
|
||||
Kind: bot.Message,
|
||||
Msg: msg.Message{
|
||||
User: &user.User{Name: "tester"},
|
||||
|
|
|
@ -4,12 +4,12 @@ package counter
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/velour/catbase/config"
|
||||
"github.com/velour/catbase/connectors/irc"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/velour/catbase/bot"
|
||||
|
@ -33,7 +33,7 @@ func makeMessage(payload string, r *regexp.Regexp) bot.Request {
|
|||
}
|
||||
values := bot.ParseValues(r, payload)
|
||||
return bot.Request{
|
||||
Conn: &cli.CliPlugin{},
|
||||
Conn: irc.New(&config.Config{}),
|
||||
Msg: msg.Message{
|
||||
User: &user.User{Name: "tester", ID: "id"},
|
||||
Body: payload,
|
||||
|
@ -280,6 +280,6 @@ func TestInspectMe(t *testing.T) {
|
|||
func TestHelp(t *testing.T) {
|
||||
mb, c := setup(t)
|
||||
assert.NotNil(t, c)
|
||||
c.help(&cli.CliPlugin{}, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
c.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
assert.Greater(t, len(mb.Messages), 1)
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/velour/catbase/bot"
|
||||
"github.com/velour/catbase/bot/msg"
|
||||
|
@ -21,7 +19,6 @@ func makeMessage(payload string) bot.Request {
|
|||
}
|
||||
values := bot.ParseValues(rollRegex, payload)
|
||||
return bot.Request{
|
||||
Conn: &cli.CliPlugin{},
|
||||
Kind: bot.Message,
|
||||
Values: values,
|
||||
Msg: msg.Message{
|
||||
|
@ -67,6 +64,6 @@ func TestHelp(t *testing.T) {
|
|||
mb := bot.NewMockBot()
|
||||
c := New(mb)
|
||||
assert.NotNil(t, c)
|
||||
c.help(&cli.CliPlugin{}, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
c.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
assert.Len(t, mb.Messages, 1)
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@ package leftpad
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/velour/catbase/bot"
|
||||
"github.com/velour/catbase/bot/msg"
|
||||
|
@ -18,7 +16,6 @@ func makeMessage(payload string) bot.Request {
|
|||
values := bot.ParseValues(leftpadRegex, payload)
|
||||
return bot.Request{
|
||||
Kind: bot.Message,
|
||||
Conn: &cli.CliPlugin{},
|
||||
Values: values,
|
||||
Msg: msg.Message{
|
||||
User: &user.User{Name: "tester"},
|
||||
|
|
|
@ -12,8 +12,6 @@ import (
|
|||
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/velour/catbase/bot"
|
||||
|
@ -45,7 +43,6 @@ func makeMessage(payload string) bot.Request {
|
|||
payload = payload[1:]
|
||||
}
|
||||
return bot.Request{
|
||||
Conn: &cli.CliPlugin{},
|
||||
Kind: bot.Message,
|
||||
Msg: msg.Message{
|
||||
User: &user.User{Name: "tester"},
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"github.com/velour/catbase/bot"
|
||||
"github.com/velour/catbase/bot/msg"
|
||||
"github.com/velour/catbase/bot/user"
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
)
|
||||
|
||||
func makeMessage(payload string) bot.Request {
|
||||
|
@ -22,7 +21,6 @@ func makeMessage(payload string) bot.Request {
|
|||
}
|
||||
values := bot.ParseValues(pickRegex, payload)
|
||||
return bot.Request{
|
||||
Conn: &cli.CliPlugin{},
|
||||
Kind: bot.Message,
|
||||
Values: values,
|
||||
Msg: msg.Message{
|
||||
|
|
|
@ -5,8 +5,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/velour/catbase/bot"
|
||||
"github.com/velour/catbase/bot/msg"
|
||||
|
@ -20,7 +18,6 @@ func makeMessage(nick, payload string, r *regexp.Regexp) bot.Request {
|
|||
payload = payload[1:]
|
||||
}
|
||||
return bot.Request{
|
||||
Conn: &cli.CliPlugin{},
|
||||
Kind: bot.Message,
|
||||
Values: bot.ParseValues(r, payload),
|
||||
Msg: msg.Message{
|
||||
|
|
|
@ -4,7 +4,6 @@ package reminder
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -24,7 +23,7 @@ func makeMessageBy(payload, by string) (bot.Connector, bot.Kind, msg.Message) {
|
|||
if isCmd {
|
||||
payload = payload[1:]
|
||||
}
|
||||
return &cli.CliPlugin{}, bot.Message, msg.Message{
|
||||
return nil, bot.Message, msg.Message{
|
||||
User: &user.User{Name: by},
|
||||
Channel: "test",
|
||||
Body: payload,
|
||||
|
@ -224,6 +223,6 @@ func TestLimitList(t *testing.T) {
|
|||
func TestHelp(t *testing.T) {
|
||||
c, mb := setup(t)
|
||||
assert.NotNil(t, c)
|
||||
c.help(&cli.CliPlugin{}, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
c.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
assert.Len(t, mb.Messages, 1)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package rss
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -17,7 +16,7 @@ func makeMessage(payload string) (bot.Connector, bot.Kind, msg.Message) {
|
|||
if isCmd {
|
||||
payload = payload[1:]
|
||||
}
|
||||
return &cli.CliPlugin{}, bot.Message, msg.Message{
|
||||
return nil, bot.Message, msg.Message{
|
||||
User: &user.User{Name: "tester"},
|
||||
Channel: "test",
|
||||
Body: payload,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package stock
|
||||
|
||||
import (
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -16,7 +15,7 @@ func makeMessage(payload string) (bot.Connector, bot.Kind, msg.Message) {
|
|||
if isCmd {
|
||||
payload = payload[1:]
|
||||
}
|
||||
return &cli.CliPlugin{}, bot.Message, msg.Message{
|
||||
return nil, bot.Message, msg.Message{
|
||||
User: &user.User{Name: "tester"},
|
||||
Channel: "test",
|
||||
Body: payload,
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
package talker
|
||||
|
||||
import (
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -18,7 +17,7 @@ func makeMessage(payload string) (bot.Connector, bot.Kind, msg.Message) {
|
|||
if isCmd {
|
||||
payload = payload[1:]
|
||||
}
|
||||
return &cli.CliPlugin{}, bot.Message, msg.Message{
|
||||
return nil, bot.Message, msg.Message{
|
||||
User: &user.User{Name: "tester"},
|
||||
Channel: "test",
|
||||
Body: payload,
|
||||
|
@ -79,6 +78,6 @@ func TestHelp(t *testing.T) {
|
|||
mb := bot.NewMockBot()
|
||||
c := New(mb)
|
||||
assert.NotNil(t, c)
|
||||
c.help(&cli.CliPlugin{}, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
c.help(nil, bot.Help, msg.Message{Channel: "channel"}, []string{})
|
||||
assert.Len(t, mb.Messages, 1)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package tldr
|
||||
|
||||
import (
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -29,7 +28,6 @@ func makeMessageBy(payload, by string) bot.Request {
|
|||
}
|
||||
|
||||
return bot.Request{
|
||||
Conn: &cli.CliPlugin{},
|
||||
Kind: bot.Message,
|
||||
Msg: msg.Message{
|
||||
User: &user.User{Name: by},
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
package twitch
|
||||
|
||||
import (
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -29,7 +28,7 @@ func makeMessage(payload string) (bot.Connector, bot.Kind, msg.Message) {
|
|||
if isCmd {
|
||||
payload = payload[1:]
|
||||
}
|
||||
return &cli.CliPlugin{}, bot.Message, msg.Message{
|
||||
return nil, bot.Message, msg.Message{
|
||||
User: &user.User{Name: "tester"},
|
||||
Channel: "test",
|
||||
Body: payload,
|
||||
|
|
|
@ -6,8 +6,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/velour/catbase/plugins/cli"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/velour/catbase/bot"
|
||||
"github.com/velour/catbase/bot/msg"
|
||||
|
@ -20,7 +18,6 @@ func makeMessage(payload string) bot.Request {
|
|||
payload = payload[1:]
|
||||
}
|
||||
return bot.Request{
|
||||
Conn: &cli.CliPlugin{},
|
||||
Kind: bot.Message,
|
||||
Msg: msg.Message{
|
||||
User: &user.User{Name: "tester"},
|
||||
|
|
Loading…
Reference in New Issue