summaryrefslogtreecommitdiffstats
path: root/store/sql_webhook_store_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'store/sql_webhook_store_test.go')
-rw-r--r--store/sql_webhook_store_test.go38
1 files changed, 36 insertions, 2 deletions
diff --git a/store/sql_webhook_store_test.go b/store/sql_webhook_store_test.go
index 401b0f904..3d79d9ad3 100644
--- a/store/sql_webhook_store_test.go
+++ b/store/sql_webhook_store_test.go
@@ -60,6 +60,40 @@ func TestWebhookStoreGetIncoming(t *testing.T) {
}
}
+func TestWebhookStoreGetIncomingList(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 r1 := <-store.Webhook().GetIncomingList(0, 1000); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ found := false
+ hooks := r1.Data.([]*model.IncomingWebhook)
+ for _, hook := range hooks {
+ if hook.Id == o1.Id {
+ found = true
+ }
+ }
+ if !found {
+ t.Fatal("missing webhook")
+ }
+ }
+
+ if result := <-store.Webhook().GetIncomingList(0, 1); result.Err != nil {
+ t.Fatal(result.Err)
+ } else {
+ if len(result.Data.([]*model.IncomingWebhook)) != 1 {
+ t.Fatal("only 1 should be returned")
+ }
+ }
+}
+
func TestWebhookStoreGetIncomingByTeam(t *testing.T) {
Setup()
@@ -70,7 +104,7 @@ func TestWebhookStoreGetIncomingByTeam(t *testing.T) {
o1 = (<-store.Webhook().SaveIncoming(o1)).Data.(*model.IncomingWebhook)
- if r1 := <-store.Webhook().GetIncomingByTeam(o1.TeamId); r1.Err != nil {
+ if r1 := <-store.Webhook().GetIncomingByTeam(o1.TeamId, 0, 100); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.([]*model.IncomingWebhook)[0].CreateAt != o1.CreateAt {
@@ -78,7 +112,7 @@ func TestWebhookStoreGetIncomingByTeam(t *testing.T) {
}
}
- if result := <-store.Webhook().GetIncomingByTeam("123"); result.Err != nil {
+ if result := <-store.Webhook().GetIncomingByTeam("123", 0, 100); result.Err != nil {
t.Fatal(result.Err)
} else {
if len(result.Data.([]*model.IncomingWebhook)) != 0 {