summaryrefslogtreecommitdiffstats
path: root/store/sql_webhook_store_test.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-02-03 08:50:25 -0500
committerChristopher Speller <crspeller@gmail.com>2016-02-03 08:50:25 -0500
commitd479b08c997d3216938a3e92c3634a8b5afdb841 (patch)
tree59e23ddb3feea7f10c16b535892b9c44952e0779 /store/sql_webhook_store_test.go
parent0571953755bb96b3d1c15279e2fb429a3ec993a5 (diff)
parent9517690577111242f12f03eb27ee32d11e9d71a6 (diff)
downloadchat-d479b08c997d3216938a3e92c3634a8b5afdb841.tar.gz
chat-d479b08c997d3216938a3e92c3634a8b5afdb841.tar.bz2
chat-d479b08c997d3216938a3e92c3634a8b5afdb841.zip
Merge pull request #2045 from mattermost/plt-1849
PLT-1849 Added extra system-wide statistics for EE
Diffstat (limited to 'store/sql_webhook_store_test.go')
-rw-r--r--store/sql_webhook_store_test.go39
1 files changed, 39 insertions, 0 deletions
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")
+ }
+ }
+}