telegraf/plugins/inputs/webhooks/webhooks_test.go

37 lines
1.2 KiB
Go
Raw Normal View History

package webhooks
import (
"reflect"
"testing"
2016-08-07 00:09:09 +00:00
"github.com/influxdata/telegraf/plugins/inputs/webhooks/dockerhub"
"github.com/influxdata/telegraf/plugins/inputs/webhooks/github"
"github.com/influxdata/telegraf/plugins/inputs/webhooks/rollbar"
)
func TestAvailableWebhooks(t *testing.T) {
wb := NewWebhooks()
expected := make([]Webhook, 0)
if !reflect.DeepEqual(wb.AvailableWebhooks(), expected) {
t.Errorf("expected to %v.\nGot %v", expected, wb.AvailableWebhooks())
}
2016-08-07 00:09:09 +00:00
wb.Dockerhub = &dockerhub.DockerhubWebhook{Path: "/dockerhub"}
expected = append(expected, wb.Dockerhub)
if !reflect.DeepEqual(wb.AvailableWebhooks(), expected) {
t.Errorf("expected to be %v.\nGot %v", expected, wb.AvailableWebhooks())
}
wb.Github = &github.GithubWebhook{Path: "/github"}
expected = append(expected, wb.Github)
if !reflect.DeepEqual(wb.AvailableWebhooks(), expected) {
t.Errorf("expected to be %v.\nGot %v", expected, wb.AvailableWebhooks())
}
wb.Rollbar = &rollbar.RollbarWebhook{Path: "/rollbar"}
expected = append(expected, wb.Rollbar)
if !reflect.DeepEqual(wb.AvailableWebhooks(), expected) {
t.Errorf("expected to be %v.\nGot %v", expected, wb.AvailableWebhooks())
}
}