summaryrefslogtreecommitdiffstats
path: root/store/storetest/team_store.go
diff options
context:
space:
mode:
authorChristian Hoff <hoff.christian@posteo.de>2018-03-01 20:11:44 +0100
committerJoram Wilander <jwawilander@gmail.com>2018-03-01 19:11:44 +0000
commit2b3b6051d265edf131d006b2eb14f55284faf1e5 (patch)
tree2bf50fd4c6ff09daf897f818aaef0c357b67ca79 /store/storetest/team_store.go
parent51c7198d53a2fbc4c7d47b3eb308781b69bf4b51 (diff)
downloadchat-2b3b6051d265edf131d006b2eb14f55284faf1e5.tar.gz
chat-2b3b6051d265edf131d006b2eb14f55284faf1e5.tar.bz2
chat-2b3b6051d265edf131d006b2eb14f55284faf1e5.zip
PLT-7567: Integration of Team Icons (#8284)
* PLT-7567: Integration of Team Icons * PLT-7567: Read replica workaround, upgrade logic moved, more concrete i18n key * PLT-7567: Read replica workaround, corrections * PLT-7567: upgrade correction
Diffstat (limited to 'store/storetest/team_store.go')
-rw-r--r--store/storetest/team_store.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/store/storetest/team_store.go b/store/storetest/team_store.go
index a32de9dba..cab06f87f 100644
--- a/store/storetest/team_store.go
+++ b/store/storetest/team_store.go
@@ -33,6 +33,7 @@ func TestTeamStore(t *testing.T, ss store.Store) {
t.Run("MemberCount", func(t *testing.T) { testTeamStoreMemberCount(t, ss) })
t.Run("GetChannelUnreadsForAllTeams", func(t *testing.T) { testGetChannelUnreadsForAllTeams(t, ss) })
t.Run("GetChannelUnreadsForTeam", func(t *testing.T) { testGetChannelUnreadsForTeam(t, ss) })
+ t.Run("UpdateLastTeamIconUpdate", func(t *testing.T) { testUpdateLastTeamIconUpdate(t, ss) })
}
func testTeamStoreSave(t *testing.T, ss store.Store) {
@@ -1003,3 +1004,28 @@ func testGetChannelUnreadsForTeam(t *testing.T, ss store.Store) {
}
}
}
+
+func testUpdateLastTeamIconUpdate(t *testing.T, ss store.Store) {
+
+ // team icon initially updated a second ago
+ lastTeamIconUpdateInitial := model.GetMillis() - 1000
+
+ o1 := &model.Team{}
+ o1.DisplayName = "Display Name"
+ o1.Name = "z-z-z" + model.NewId() + "b"
+ o1.Email = model.NewId() + "@nowhere.com"
+ o1.Type = model.TEAM_OPEN
+ o1.LastTeamIconUpdate = lastTeamIconUpdateInitial
+ o1 = (<-ss.Team().Save(o1)).Data.(*model.Team)
+
+ curTime := model.GetMillis()
+
+ if err := (<-ss.Team().UpdateLastTeamIconUpdate(o1.Id, curTime)).Err; err != nil {
+ t.Fatal(err)
+ }
+
+ ro1 := (<-ss.Team().Get(o1.Id)).Data.(*model.Team)
+ if ro1.LastTeamIconUpdate <= lastTeamIconUpdateInitial {
+ t.Fatal("LastTeamIconUpdate not updated")
+ }
+}