mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-01 07:26:48 +00:00
Engine: Protocol Features, coverage, types, BTC markets websocket (#368)
* Attempts to update orderbook so it doesn't need to sort * Reverts the ws ob stuff. Gets rid of sorting because it happens later. Adds some exchange features * update existing feature lists. Expands list definition to match my emotions * Adds bithumb bitmex and bitstamp. adds a couple more types * Features for you, features for me, features for bittrex, btcmarkets, btse, coinbasepro, coinut, exmo, gateio and gemini * Features for hitbtc, huobi, itbit, kraken, lakebtc, lbank, localbitcoins, okcoin, okex, poloniex, yobit, zb * Who can forget good old alphapoint? * Adds btcmarksets websocket :glitch_crab: fixes alphapoint features * Adds extra data not in the documentation :/ * Replaces websocket features by using protocol features. However, it breaks it due to import cycles. I'm not sure what I'll do just yet * Removes import cycle via duplicate structs. * Increases coverage of config with `TestCheckCurrencyConfigValues`. Moves all currency pair package types into their own files or places it at the bottom of files if necessary * Increase coverage in code.go * One way of determining a test has failed, is when to it fails. Removed redundant explanation * Increases code coverage of conversion * Lint fixes * Fixes orderbook tests * Re-adds sorting because its important to still have the internal pre-processed orderbook to be representative of a real orderbook * Secret lints that did not show up via Windows linting * Adds protocol package to contain exchange features * Fixes protocol implementation * Fixes ws tests * Addresses the following: Removes st-st-stutters in config types, changes GetAvailableForexProviders -> GetSupportedForexProviders, removes errors from tests where error is nil, removes orderbook setup when not necessary, removes import newlines, removes false bools from declaration, changes should of to should have * imports and casing * Fixes two more nil error checks
This commit is contained in:
@@ -19,19 +19,19 @@ func TestStart(t *testing.T) {
|
||||
|
||||
func TestIsEnabled(t *testing.T) {
|
||||
if !b.IsEnabled() {
|
||||
t.Error("test failed - base IsEnabled() error")
|
||||
t.Error("base IsEnabled() error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsConnected(t *testing.T) {
|
||||
if !b.IsConnected() {
|
||||
t.Error("test failed - base IsConnected() error")
|
||||
t.Error("base IsConnected() error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetName(t *testing.T) {
|
||||
if b.GetName() != "test" {
|
||||
t.Error("test failed - base GetName() error")
|
||||
t.Error("base GetName() error")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ func TestNewComm(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(communications.IComm) != 4 {
|
||||
t.Errorf("Test failed, communications NewComm, expected len 4, got len %d",
|
||||
t.Errorf("communications NewComm, expected len 4, got len %d",
|
||||
len(communications.IComm))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ func TestSetup(t *testing.T) {
|
||||
func TestConnect(t *testing.T) {
|
||||
err := s.Connect()
|
||||
if err == nil {
|
||||
t.Error("test failed - slack Connect() error cannot be nil")
|
||||
t.Error("slack Connect() error cannot be nil")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ func TestPushEvent(t *testing.T) {
|
||||
t.Parallel()
|
||||
err := s.PushEvent(base.Event{})
|
||||
if err == nil {
|
||||
t.Error("test failed - slack PushEvent() error cannot be nil")
|
||||
t.Error("slack PushEvent() error cannot be nil")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func TestBuildURL(t *testing.T) {
|
||||
t.Parallel()
|
||||
v := s.BuildURL("lol123")
|
||||
if v != "https://slack.com/api/rtm.start?token=lol123" {
|
||||
t.Error("test failed - slack BuildURL() error")
|
||||
t.Error("slack BuildURL() error")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,14 +101,14 @@ func TestGetChannelsString(t *testing.T) {
|
||||
}
|
||||
}
|
||||
if !testpassed {
|
||||
t.Error("test failed - slack GetChannelsString() error")
|
||||
t.Error("slack GetChannelsString() error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetUsernameByID(t *testing.T) {
|
||||
username := s.GetUsernameByID("1337")
|
||||
if username != "" {
|
||||
t.Error("test failed - slack GetUsernameByID() error")
|
||||
t.Error("slack GetUsernameByID() error")
|
||||
}
|
||||
|
||||
s.Details.Users = append(s.Details.Users, struct {
|
||||
@@ -141,7 +141,7 @@ func TestGetUsernameByID(t *testing.T) {
|
||||
|
||||
username = s.GetUsernameByID("1337")
|
||||
if username != "cranktakular" {
|
||||
t.Error("test failed - slack GetUsernameByID() error")
|
||||
t.Error("slack GetUsernameByID() error")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -149,7 +149,7 @@ func TestGetUsernameByID(t *testing.T) {
|
||||
func TestGetIDByName(t *testing.T) {
|
||||
id, err := s.GetIDByName("batman")
|
||||
if err == nil || id != "" {
|
||||
t.Error("test failed - slack GetIDByName() error")
|
||||
t.Error("slack GetIDByName() error")
|
||||
}
|
||||
|
||||
s.Details.Groups = append(s.Details.Groups, group{
|
||||
@@ -158,7 +158,7 @@ func TestGetIDByName(t *testing.T) {
|
||||
})
|
||||
id, err = s.GetIDByName("this is a group")
|
||||
if err != nil || id != "210314" {
|
||||
t.Errorf("test failed - slack GetIDByName() Expected '210314' Actual '%s' Error: %s",
|
||||
t.Errorf("slack GetIDByName() Expected '210314' Actual '%s' Error: %s",
|
||||
id, err)
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ func TestGetIDByName(t *testing.T) {
|
||||
func TestGetGroupIDByName(t *testing.T) {
|
||||
id, err := s.GetGroupIDByName("batman")
|
||||
if err == nil || id != "" {
|
||||
t.Error("test failed - slack GetGroupIDByName() error")
|
||||
t.Error("slack GetGroupIDByName() error")
|
||||
}
|
||||
|
||||
s.Details.Groups = append(s.Details.Groups, group{
|
||||
@@ -175,7 +175,7 @@ func TestGetGroupIDByName(t *testing.T) {
|
||||
})
|
||||
id, err = s.GetGroupIDByName("another group")
|
||||
if err != nil || id != "11223344" {
|
||||
t.Errorf("test failed - slack GetGroupIDByName() Expected '11223344' Actual '%s' Error: %s",
|
||||
t.Errorf("slack GetGroupIDByName() Expected '11223344' Actual '%s' Error: %s",
|
||||
id, err)
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ func TestGetGroupIDByName(t *testing.T) {
|
||||
func TestGetChannelIDByName(t *testing.T) {
|
||||
id, err := s.GetChannelIDByName("1337")
|
||||
if err == nil || id != "" {
|
||||
t.Error("test failed - slack GetChannelIDByName() error")
|
||||
t.Error("slack GetChannelIDByName() error")
|
||||
}
|
||||
|
||||
s.Details.Channels = append(s.Details.Channels, struct {
|
||||
@@ -208,7 +208,7 @@ func TestGetChannelIDByName(t *testing.T) {
|
||||
|
||||
id, err = s.GetChannelIDByName("Slack Test")
|
||||
if err != nil || id != "2048" {
|
||||
t.Errorf("test failed - slack GetChannelIDByName() Expected '2048' Actual '%s' Error: %s",
|
||||
t.Errorf("slack GetChannelIDByName() Expected '2048' Actual '%s' Error: %s",
|
||||
id, err)
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ func TestGetChannelIDByName(t *testing.T) {
|
||||
func TestGetUsersInGroup(t *testing.T) {
|
||||
username := s.GetUsersInGroup("supergroup")
|
||||
if len(username) != 0 {
|
||||
t.Error("test failed - slack GetUsersInGroup() error")
|
||||
t.Error("slack GetUsersInGroup() error")
|
||||
}
|
||||
|
||||
s.Details.Groups = append(s.Details.Groups, group{
|
||||
@@ -227,7 +227,7 @@ func TestGetUsersInGroup(t *testing.T) {
|
||||
|
||||
username = s.GetUsersInGroup("three guys")
|
||||
if len(username) != 3 {
|
||||
t.Errorf("test failed - slack GetUsersInGroup() Expected '3' Actual '%s'",
|
||||
t.Errorf("slack GetUsersInGroup() Expected '3' Actual '%s'",
|
||||
username)
|
||||
}
|
||||
}
|
||||
@@ -235,14 +235,14 @@ func TestGetUsersInGroup(t *testing.T) {
|
||||
func TestNewConnection(t *testing.T) {
|
||||
err := s.NewConnection()
|
||||
if err == nil {
|
||||
t.Error("test failed - slack NewConnection() error")
|
||||
t.Error("slack NewConnection() error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWebsocketConnect(t *testing.T) {
|
||||
err := s.WebsocketConnect()
|
||||
if err == nil {
|
||||
t.Error("test failed - slack WebsocketConnect() error")
|
||||
t.Error("slack WebsocketConnect() error")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,13 +253,13 @@ func TestHandlePresenceChange(t *testing.T) {
|
||||
|
||||
err := s.handlePresenceChange([]byte(`{"malformedjson}`))
|
||||
if err == nil {
|
||||
t.Error("test failed - slack handlePresenceChange(), unmarshalled malformed json")
|
||||
t.Error("slack handlePresenceChange(), unmarshalled malformed json")
|
||||
}
|
||||
|
||||
data, _ := common.JSONEncode(pres)
|
||||
err = s.handlePresenceChange(data)
|
||||
if err != nil {
|
||||
t.Errorf("test failed - slack handlePresenceChange() Error: %s", err)
|
||||
t.Errorf("slack handlePresenceChange() Error: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ func TestHandleMessageResponse(t *testing.T) {
|
||||
|
||||
err := s.handleMessageResponse(nil, data)
|
||||
if err.Error() != "reply to is != 0" {
|
||||
t.Errorf("test failed - slack handleMessageResponse(), Incorrect Error: %s",
|
||||
t.Errorf("slack handleMessageResponse(), Incorrect Error: %s",
|
||||
err)
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ func TestHandleMessageResponse(t *testing.T) {
|
||||
|
||||
err = s.handleMessageResponse([]byte(`{"malformedjson}`), data)
|
||||
if err == nil {
|
||||
t.Error("test failed - slack handleMessageResponse(), unmarshalled malformed json")
|
||||
t.Error("slack handleMessageResponse(), unmarshalled malformed json")
|
||||
}
|
||||
|
||||
var msg Message
|
||||
@@ -287,7 +287,7 @@ func TestHandleMessageResponse(t *testing.T) {
|
||||
|
||||
err = s.handleMessageResponse(resp, data)
|
||||
if err != nil {
|
||||
t.Error("test failed - slack HandleMessage(), Sent message through nil websocket")
|
||||
t.Error("slack HandleMessage(), Sent message through nil websocket")
|
||||
}
|
||||
|
||||
msg.Text = "!notacommand"
|
||||
@@ -295,7 +295,7 @@ func TestHandleMessageResponse(t *testing.T) {
|
||||
|
||||
err = s.handleMessageResponse(resp, data)
|
||||
if err == nil {
|
||||
t.Errorf("test failed - slack handleMessageResponse() Error: %s", err)
|
||||
t.Errorf("slack handleMessageResponse() Expected error")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,13 +303,13 @@ func TestHandleErrorResponse(t *testing.T) {
|
||||
var data WebsocketResponse
|
||||
err := s.handleErrorResponse(data)
|
||||
if err == nil {
|
||||
t.Error("test failed - slack handleErrorResponse() Ignored strange input")
|
||||
t.Error("slack handleErrorResponse() Ignored strange input")
|
||||
}
|
||||
|
||||
data.Error.Msg = "Socket URL has expired"
|
||||
err = s.handleErrorResponse(data)
|
||||
if err == nil {
|
||||
t.Error("test failed - slack handleErrorResponse() Didn't error on nil websocket")
|
||||
t.Error("slack handleErrorResponse() Didn't error on nil websocket")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ func TestHandleHelloResponse(t *testing.T) {
|
||||
func TestHandleReconnectResponse(t *testing.T) {
|
||||
err := s.handleReconnectResponse([]byte(`{"malformedjson}`))
|
||||
if err == nil {
|
||||
t.Error("test failed - slack handleReconnectResponse(), unmarshalled malformed json")
|
||||
t.Error("slack handleReconnectResponse(), unmarshalled malformed json")
|
||||
}
|
||||
|
||||
var testURL struct {
|
||||
@@ -332,7 +332,7 @@ func TestHandleReconnectResponse(t *testing.T) {
|
||||
|
||||
err = s.handleReconnectResponse(data)
|
||||
if err != nil || s.ReconnectURL != "https://www.thrasher.io" {
|
||||
t.Errorf("test failed - slack handleReconnectResponse() Expected 'https://www.thrasher.io' Actual '%s' Error: %s",
|
||||
t.Errorf("slack handleReconnectResponse() Expected 'https://www.thrasher.io' Actual '%s' Error: %s",
|
||||
s.ReconnectURL, err)
|
||||
}
|
||||
}
|
||||
@@ -340,7 +340,7 @@ func TestHandleReconnectResponse(t *testing.T) {
|
||||
func TestWebsocketSend(t *testing.T) {
|
||||
err := s.WebsocketSend("test", "Hello World!")
|
||||
if err == nil {
|
||||
t.Error("test failed - slack WebsocketSend(), Sent message through nil websocket")
|
||||
t.Error("slack WebsocketSend(), Sent message through nil websocket")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,16 +348,16 @@ func TestHandleMessage(t *testing.T) {
|
||||
msg := &Message{}
|
||||
err := s.HandleMessage(msg)
|
||||
if err == nil {
|
||||
t.Error("test failed - slack HandleMessage(), Sent message through nil websocket")
|
||||
t.Error("slack HandleMessage(), Sent message through nil websocket")
|
||||
}
|
||||
msg.Text = cmdStatus
|
||||
err = s.HandleMessage(msg)
|
||||
if err == nil {
|
||||
t.Error("test failed - slack HandleMessage(), Sent message through nil websocket")
|
||||
t.Error("slack HandleMessage(), Sent message through nil websocket")
|
||||
}
|
||||
msg.Text = cmdHelp
|
||||
err = s.HandleMessage(msg)
|
||||
if err == nil {
|
||||
t.Error("test failed - slack HandleMessage(), Sent message through nil websocket")
|
||||
t.Error("slack HandleMessage(), Sent message through nil websocket")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,82 +22,82 @@ func TestSetup(t *testing.T) {
|
||||
func TestConnect(t *testing.T) {
|
||||
err := s.Connect()
|
||||
if err != nil {
|
||||
t.Error("test failed - SMSGlobal Connect() error", err)
|
||||
t.Error("SMSGlobal Connect() error", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPushEvent(t *testing.T) {
|
||||
err := s.PushEvent(base.Event{})
|
||||
if err != nil {
|
||||
t.Error("test failed - SMSGlobal PushEvent() error", err)
|
||||
t.Error("SMSGlobal PushEvent() error", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetEnabledContacts(t *testing.T) {
|
||||
v := s.GetEnabledContacts()
|
||||
if v != 1 {
|
||||
t.Error("test failed - SMSGlobal GetEnabledContacts() error")
|
||||
t.Error("SMSGlobal GetEnabledContacts() error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetContactByNumber(t *testing.T) {
|
||||
_, err := s.GetContactByNumber("1231424")
|
||||
if err != nil {
|
||||
t.Error("test failed - SMSGlobal GetContactByNumber() error", err)
|
||||
t.Error("SMSGlobal GetContactByNumber() error", err)
|
||||
}
|
||||
_, err = s.GetContactByNumber("basketball")
|
||||
if err == nil {
|
||||
t.Error("test failed - SMSGlobal GetContactByNumber() error")
|
||||
t.Error("SMSGlobal GetContactByNumber() error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetContactByName(t *testing.T) {
|
||||
_, err := s.GetContactByName("StyleGherkin")
|
||||
if err != nil {
|
||||
t.Error("test failed - SMSGlobal GetContactByName() error", err)
|
||||
t.Error("SMSGlobal GetContactByName() error", err)
|
||||
}
|
||||
_, err = s.GetContactByName("blah")
|
||||
if err == nil {
|
||||
t.Error("test failed - SMSGlobal GetContactByName() error")
|
||||
t.Error("SMSGlobal GetContactByName() error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAddContact(t *testing.T) {
|
||||
err := s.AddContact(Contact{Name: "bra", Number: "2876", Enabled: true})
|
||||
if err != nil {
|
||||
t.Error("test failed - SMSGlobal AddContact() error", err)
|
||||
t.Error("SMSGlobal AddContact() error", err)
|
||||
}
|
||||
err = s.AddContact(Contact{Name: "StyleGherkin", Number: "1231424", Enabled: true})
|
||||
if err == nil {
|
||||
t.Error("test failed - SMSGlobal AddContact() error")
|
||||
t.Error("SMSGlobal AddContact() error")
|
||||
}
|
||||
err = s.AddContact(Contact{Name: "", Number: "", Enabled: true})
|
||||
if err == nil {
|
||||
t.Error("test failed - SMSGlobal AddContact() error")
|
||||
t.Error("SMSGlobal AddContact() error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveContact(t *testing.T) {
|
||||
err := s.RemoveContact(Contact{Name: "StyleGherkin", Number: "1231424", Enabled: true})
|
||||
if err != nil {
|
||||
t.Error("test failed - SMSGlobal RemoveContact() error", err)
|
||||
t.Error("SMSGlobal RemoveContact() error", err)
|
||||
}
|
||||
err = s.RemoveContact(Contact{Name: "frieda", Number: "243453", Enabled: true})
|
||||
if err == nil {
|
||||
t.Error("test failed - SMSGlobal RemoveContact() error", err)
|
||||
t.Error("SMSGlobal RemoveContact() Expected error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSendMessageToAll(t *testing.T) {
|
||||
err := s.SendMessageToAll("Hello,World!")
|
||||
if err != nil {
|
||||
t.Error("test failed - SMSGlobal SendMessageToAll() error", err)
|
||||
t.Error("SMSGlobal SendMessageToAll() error", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSendMessage(t *testing.T) {
|
||||
err := s.SendMessage("1337", "Hello!")
|
||||
if err != nil {
|
||||
t.Error("test failed - SMSGlobal SendMessage() error", err)
|
||||
t.Error("SMSGlobal SendMessage() error", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,24 +22,24 @@ func TestSetup(t *testing.T) {
|
||||
func TestConnect(t *testing.T) {
|
||||
err := s.Connect()
|
||||
if err != nil {
|
||||
t.Error("test failed - smtpservice Connect() error", err)
|
||||
t.Error("smtpservice Connect() error", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPushEvent(t *testing.T) {
|
||||
err := s.PushEvent(base.Event{})
|
||||
if err == nil {
|
||||
t.Error("test failed - smtpservice PushEvent() error cannot be nil")
|
||||
t.Error("smtpservice PushEvent() error cannot be nil")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSend(t *testing.T) {
|
||||
err := s.Send("", "")
|
||||
if err == nil {
|
||||
t.Error("test failed - smtpservice Send() error cannot be nil")
|
||||
t.Error("smtpservice Send() error cannot be nil")
|
||||
}
|
||||
err = s.Send("subject", "alertmessage")
|
||||
if err == nil {
|
||||
t.Error("test failed - smtpservice Send() error cannot be nil")
|
||||
t.Error("smtpservice Send() error cannot be nil")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestSetup(t *testing.T) {
|
||||
commsCfg := cfg.GetCommunicationsConfig()
|
||||
T.Setup(&commsCfg)
|
||||
if T.Name != "Telegram" || T.Enabled || T.Token != "testest" || T.Verbose {
|
||||
t.Error("test failed - telegram Setup() error, unexpected setup values",
|
||||
t.Error("telegram Setup() error, unexpected setup values",
|
||||
T.Name,
|
||||
T.Enabled,
|
||||
T.Token,
|
||||
@@ -33,19 +33,19 @@ func TestSetup(t *testing.T) {
|
||||
func TestConnect(t *testing.T) {
|
||||
err := T.Connect()
|
||||
if err == nil {
|
||||
t.Error("test failed - telegram Connect() error")
|
||||
t.Error("telegram Connect() error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPushEvent(t *testing.T) {
|
||||
err := T.PushEvent(base.Event{})
|
||||
if err != nil {
|
||||
t.Error("test failed - telegram PushEvent() error", err)
|
||||
t.Error("telegram PushEvent() error", err)
|
||||
}
|
||||
T.AuthorisedClients = append(T.AuthorisedClients, 1337)
|
||||
err = T.PushEvent(base.Event{})
|
||||
if err.Error() != testErrNotFound {
|
||||
t.Errorf("test failed - telegram PushEvent() error, expected 'Not found' got '%s'",
|
||||
t.Errorf("telegram PushEvent() error, expected 'Not found' got '%s'",
|
||||
err)
|
||||
}
|
||||
}
|
||||
@@ -55,27 +55,27 @@ func TestHandleMessages(t *testing.T) {
|
||||
chatID := int64(1337)
|
||||
err := T.HandleMessages(cmdHelp, chatID)
|
||||
if err.Error() != testErrNotFound {
|
||||
t.Errorf("test failed - telegram HandleMessages() error, expected 'Not found' got '%s'",
|
||||
t.Errorf("telegram HandleMessages() error, expected 'Not found' got '%s'",
|
||||
err)
|
||||
}
|
||||
err = T.HandleMessages(cmdStart, chatID)
|
||||
if err.Error() != testErrNotFound {
|
||||
t.Errorf("test failed - telegram HandleMessages() error, expected 'Not found' got '%s'",
|
||||
t.Errorf("telegram HandleMessages() error, expected 'Not found' got '%s'",
|
||||
err)
|
||||
}
|
||||
err = T.HandleMessages(cmdStatus, chatID)
|
||||
if err.Error() != testErrNotFound {
|
||||
t.Errorf("test failed - telegram HandleMessages() error, expected 'Not found' got '%s'",
|
||||
t.Errorf("telegram HandleMessages() error, expected 'Not found' got '%s'",
|
||||
err)
|
||||
}
|
||||
err = T.HandleMessages(cmdSettings, chatID)
|
||||
if err.Error() != testErrNotFound {
|
||||
t.Errorf("test failed - telegram HandleMessages() error, expected 'Not found' got '%s'",
|
||||
t.Errorf("telegram HandleMessages() error, expected 'Not found' got '%s'",
|
||||
err)
|
||||
}
|
||||
err = T.HandleMessages("Not a command", chatID)
|
||||
if err.Error() != testErrNotFound {
|
||||
t.Errorf("test failed - telegram HandleMessages() error, expected 'Not found' got '%s'",
|
||||
t.Errorf("telegram HandleMessages() error, expected 'Not found' got '%s'",
|
||||
err)
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ func TestGetUpdates(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, err := T.GetUpdates()
|
||||
if err != nil {
|
||||
t.Error("test failed - telegram GetUpdates() error", err)
|
||||
t.Error("telegram GetUpdates() error", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func TestTestConnection(t *testing.T) {
|
||||
t.Parallel()
|
||||
err := T.TestConnection()
|
||||
if err.Error() != testErrNotFound {
|
||||
t.Errorf("test failed - telegram TestConnection() error, expected 'Not found' got '%s'",
|
||||
t.Errorf("telegram TestConnection() error, expected 'Not found' got '%s'",
|
||||
err)
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ func TestSendMessage(t *testing.T) {
|
||||
t.Parallel()
|
||||
err := T.SendMessage("Test message", int64(1337))
|
||||
if err.Error() != testErrNotFound {
|
||||
t.Errorf("test failed - telegram SendMessage() error, expected 'Not found' got '%s'",
|
||||
t.Errorf("telegram SendMessage() error, expected 'Not found' got '%s'",
|
||||
err)
|
||||
}
|
||||
}
|
||||
@@ -110,6 +110,6 @@ func TestSendHTTPRequest(t *testing.T) {
|
||||
t.Parallel()
|
||||
err := T.SendHTTPRequest("0.0.0.0", nil, nil)
|
||||
if err == nil {
|
||||
t.Error("test failed - telegram SendHTTPRequest() error")
|
||||
t.Error("telegram SendHTTPRequest() error")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user