diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-01-27 14:07:34 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-27 14:07:34 -0500 |
commit | 097289f8e473c799ee752aa56e08f605110f5217 (patch) | |
tree | 424cd42d691b28d1c08852dc02a69d69f2b70a65 /store/sql_webhook_store_test.go | |
parent | 8eab04e944b3874f1fc4985344cbccec84c6002a (diff) | |
download | chat-097289f8e473c799ee752aa56e08f605110f5217.tar.gz chat-097289f8e473c799ee752aa56e08f605110f5217.tar.bz2 chat-097289f8e473c799ee752aa56e08f605110f5217.zip |
Merge 3.6.2 into master (#5211)
* Add webhook cache
* Add channel by name cache
* Fxing profiles in channels cache
* Fix merge
Diffstat (limited to 'store/sql_webhook_store_test.go')
-rw-r--r-- | store/sql_webhook_store_test.go | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/store/sql_webhook_store_test.go b/store/sql_webhook_store_test.go index 251ecf597..401b0f904 100644 --- a/store/sql_webhook_store_test.go +++ b/store/sql_webhook_store_test.go @@ -35,7 +35,7 @@ func TestWebhookStoreGetIncoming(t *testing.T) { o1 = (<-store.Webhook().SaveIncoming(o1)).Data.(*model.IncomingWebhook) - if r1 := <-store.Webhook().GetIncoming(o1.Id); r1.Err != nil { + if r1 := <-store.Webhook().GetIncoming(o1.Id, false); r1.Err != nil { t.Fatal(r1.Err) } else { if r1.Data.(*model.IncomingWebhook).CreateAt != o1.CreateAt { @@ -43,7 +43,19 @@ func TestWebhookStoreGetIncoming(t *testing.T) { } } - if err := (<-store.Webhook().GetIncoming("123")).Err; err == nil { + if r1 := <-store.Webhook().GetIncoming(o1.Id, true); r1.Err != nil { + t.Fatal(r1.Err) + } else { + if r1.Data.(*model.IncomingWebhook).CreateAt != o1.CreateAt { + t.Fatal("invalid returned webhook") + } + } + + if err := (<-store.Webhook().GetIncoming("123", false)).Err; err == nil { + t.Fatal("Missing id should have failed") + } + + if err := (<-store.Webhook().GetIncoming("123", true)).Err; err == nil { t.Fatal("Missing id should have failed") } } @@ -85,7 +97,7 @@ func TestWebhookStoreDeleteIncoming(t *testing.T) { o1 = (<-store.Webhook().SaveIncoming(o1)).Data.(*model.IncomingWebhook) - if r1 := <-store.Webhook().GetIncoming(o1.Id); r1.Err != nil { + if r1 := <-store.Webhook().GetIncoming(o1.Id, true); r1.Err != nil { t.Fatal(r1.Err) } else { if r1.Data.(*model.IncomingWebhook).CreateAt != o1.CreateAt { @@ -97,7 +109,9 @@ func TestWebhookStoreDeleteIncoming(t *testing.T) { t.Fatal(r2.Err) } - if r3 := (<-store.Webhook().GetIncoming(o1.Id)); r3.Err == nil { + ClearWebhookCaches() + + if r3 := (<-store.Webhook().GetIncoming(o1.Id, true)); r3.Err == nil { t.Log(r3.Data) t.Fatal("Missing id should have failed") } @@ -113,7 +127,7 @@ func TestWebhookStoreDeleteIncomingByUser(t *testing.T) { o1 = (<-store.Webhook().SaveIncoming(o1)).Data.(*model.IncomingWebhook) - if r1 := <-store.Webhook().GetIncoming(o1.Id); r1.Err != nil { + if r1 := <-store.Webhook().GetIncoming(o1.Id, true); r1.Err != nil { t.Fatal(r1.Err) } else { if r1.Data.(*model.IncomingWebhook).CreateAt != o1.CreateAt { @@ -125,7 +139,9 @@ func TestWebhookStoreDeleteIncomingByUser(t *testing.T) { t.Fatal(r2.Err) } - if r3 := (<-store.Webhook().GetIncoming(o1.Id)); r3.Err == nil { + ClearWebhookCaches() + + if r3 := (<-store.Webhook().GetIncoming(o1.Id, true)); r3.Err == nil { t.Log(r3.Data) t.Fatal("Missing id should have failed") } |