summaryrefslogtreecommitdiffstats
path: root/store/sql_channel_store_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-27 14:07:34 -0500
committerGitHub <noreply@github.com>2017-01-27 14:07:34 -0500
commit097289f8e473c799ee752aa56e08f605110f5217 (patch)
tree424cd42d691b28d1c08852dc02a69d69f2b70a65 /store/sql_channel_store_test.go
parent8eab04e944b3874f1fc4985344cbccec84c6002a (diff)
downloadchat-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_channel_store_test.go')
-rw-r--r--store/sql_channel_store_test.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/store/sql_channel_store_test.go b/store/sql_channel_store_test.go
index 5202a7c29..90a5f4479 100644
--- a/store/sql_channel_store_test.go
+++ b/store/sql_channel_store_test.go
@@ -352,7 +352,7 @@ func TestChannelStoreGetByName(t *testing.T) {
o1.Type = model.CHANNEL_OPEN
Must(store.Channel().Save(&o1))
- r1 := <-store.Channel().GetByName(o1.TeamId, o1.Name)
+ r1 := <-store.Channel().GetByName(o1.TeamId, o1.Name, true)
if r1.Err != nil {
t.Fatal(r1.Err)
} else {
@@ -361,13 +361,25 @@ func TestChannelStoreGetByName(t *testing.T) {
}
}
- if err := (<-store.Channel().GetByName(o1.TeamId, "")).Err; err == nil {
+ if err := (<-store.Channel().GetByName(o1.TeamId, "", true)).Err; err == nil {
+ t.Fatal("Missing id should have failed")
+ }
+
+ if r1 := <-store.Channel().GetByName(o1.TeamId, o1.Name, false); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ if r1.Data.(*model.Channel).ToJson() != o1.ToJson() {
+ t.Fatal("invalid returned channel")
+ }
+ }
+
+ if err := (<-store.Channel().GetByName(o1.TeamId, "", false)).Err; err == nil {
t.Fatal("Missing id should have failed")
}
Must(store.Channel().Delete(r1.Data.(*model.Channel).Id, model.GetMillis()))
- if err := (<-store.Channel().GetByName(o1.TeamId, "")).Err; err == nil {
+ if err := (<-store.Channel().GetByName(o1.TeamId, "", false)).Err; err == nil {
t.Fatal("Deleted channel should not be returned by GetByName()")
}
}