summaryrefslogtreecommitdiffstats
path: root/store/sql_webhook_store_test.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-02-03 10:45:58 -0800
committer=Corey Hulen <corey@hulen.com>2016-02-03 10:45:58 -0800
commitbdfa4715d65ed4b4e903a1eb4c83eba6c95455d1 (patch)
tree1626d089802a92ee208b6e7fa056378e40568a92 /store/sql_webhook_store_test.go
parent581785f5044eecdc7cf664e4c7fc59efc6babc96 (diff)
parent9bba6c79882d1f5d14b98052caf59a11fc2388d5 (diff)
downloadchat-bdfa4715d65ed4b4e903a1eb4c83eba6c95455d1.tar.gz
chat-bdfa4715d65ed4b4e903a1eb4c83eba6c95455d1.tar.bz2
chat-bdfa4715d65ed4b4e903a1eb4c83eba6c95455d1.zip
Merge branch 'master' into PLT-1429
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 5b43d0730..251ecf597 100644
--- a/store/sql_webhook_store_test.go
+++ b/store/sql_webhook_store_test.go
@@ -304,3 +304,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")
+ }
+ }
+}