summaryrefslogtreecommitdiffstats
path: root/store/sql_user_store_test.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-12-13 19:23:36 -0800
committerenahum <nahumhbl@gmail.com>2016-12-14 00:23:36 -0300
commitaacbe995483b694e169acdc63136171dff3725d9 (patch)
treee60e67a1378ce929f42e41a49c2215a0289eae78 /store/sql_user_store_test.go
parent51b794501e21e1d19a58bb6dc273a5425c03a107 (diff)
downloadchat-aacbe995483b694e169acdc63136171dff3725d9.tar.gz
chat-aacbe995483b694e169acdc63136171dff3725d9.tar.bz2
chat-aacbe995483b694e169acdc63136171dff3725d9.zip
PLT-4982 Adding caching to user profiles (#4782)
Diffstat (limited to 'store/sql_user_store_test.go')
-rw-r--r--store/sql_user_store_test.go56
1 files changed, 54 insertions, 2 deletions
diff --git a/store/sql_user_store_test.go b/store/sql_user_store_test.go
index 56d9c0a6a..765a164e3 100644
--- a/store/sql_user_store_test.go
+++ b/store/sql_user_store_test.go
@@ -453,7 +453,59 @@ func TestUserStoreGetProfilesByIds(t *testing.T) {
Must(store.User().Save(u2))
Must(store.Team().SaveMember(&model.TeamMember{TeamId: teamId, UserId: u2.Id}))
- if r1 := <-store.User().GetProfileByIds([]string{u1.Id, u2.Id}); r1.Err != nil {
+ if r1 := <-store.User().GetProfileByIds([]string{u1.Id}, false); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ users := r1.Data.(map[string]*model.User)
+ if len(users) != 1 {
+ t.Fatal("invalid returned users")
+ }
+
+ if users[u1.Id].Id != u1.Id {
+ t.Fatal("invalid returned user")
+ }
+ }
+
+ if r1 := <-store.User().GetProfileByIds([]string{u1.Id}, true); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ users := r1.Data.(map[string]*model.User)
+ if len(users) != 1 {
+ t.Fatal("invalid returned users")
+ }
+
+ if users[u1.Id].Id != u1.Id {
+ t.Fatal("invalid returned user")
+ }
+ }
+
+ if r1 := <-store.User().GetProfileByIds([]string{u1.Id, u2.Id}, true); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ users := r1.Data.(map[string]*model.User)
+ if len(users) != 2 {
+ t.Fatal("invalid returned users")
+ }
+
+ if users[u1.Id].Id != u1.Id {
+ t.Fatal("invalid returned user")
+ }
+ }
+
+ if r1 := <-store.User().GetProfileByIds([]string{u1.Id, u2.Id}, true); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ users := r1.Data.(map[string]*model.User)
+ if len(users) != 2 {
+ t.Fatal("invalid returned users")
+ }
+
+ if users[u1.Id].Id != u1.Id {
+ t.Fatal("invalid returned user")
+ }
+ }
+
+ if r1 := <-store.User().GetProfileByIds([]string{u1.Id, u2.Id}, false); r1.Err != nil {
t.Fatal(r1.Err)
} else {
users := r1.Data.(map[string]*model.User)
@@ -466,7 +518,7 @@ func TestUserStoreGetProfilesByIds(t *testing.T) {
}
}
- if r1 := <-store.User().GetProfileByIds([]string{u1.Id}); r1.Err != nil {
+ if r1 := <-store.User().GetProfileByIds([]string{u1.Id}, false); r1.Err != nil {
t.Fatal(r1.Err)
} else {
users := r1.Data.(map[string]*model.User)