From 3d03bdf2f1af5385c2150544977fbba89650b1ee Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Tue, 2 Feb 2016 08:41:02 -0500 Subject: Added extra system-wide statistics for EE --- store/sql_webhook_store_test.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'store/sql_webhook_store_test.go') diff --git a/store/sql_webhook_store_test.go b/store/sql_webhook_store_test.go index 1a9d5be3b..089e38244 100644 --- a/store/sql_webhook_store_test.go +++ b/store/sql_webhook_store_test.go @@ -332,3 +332,42 @@ func TestWebhookStoreUpdateOutgoing(t *testing.T) { t.Fatal(r2.Err) } } + +func TestWebhookStoreCountIncoming(t *testing.T) { + Setup() + + o1 := &model.IncomingWebhook{} + o1.ChannelId = model.NewId() + o1.UserId = model.NewId() + o1.TeamId = model.NewId() + + o1 = (<-store.Webhook().SaveIncoming(o1)).Data.(*model.IncomingWebhook) + + if r := <-store.Webhook().AnalyticsIncomingCount(""); r.Err != nil { + t.Fatal(r.Err) + } else { + if r.Data.(int64) == 0 { + t.Fatal("should have at least 1 incoming hook") + } + } +} + +func TestWebhookStoreCountOutgoing(t *testing.T) { + Setup() + + o1 := &model.OutgoingWebhook{} + o1.ChannelId = model.NewId() + o1.CreatorId = model.NewId() + o1.TeamId = model.NewId() + o1.CallbackURLs = []string{"http://nowhere.com/"} + + o1 = (<-store.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook) + + if r := <-store.Webhook().AnalyticsOutgoingCount(""); r.Err != nil { + t.Fatal(r.Err) + } else { + if r.Data.(int64) == 0 { + t.Fatal("should have at least 1 outgoing hook") + } + } +} -- cgit v1.2.3-1-g7c22