diff options
author | George Goldberg <george@gberg.me> | 2018-09-17 15:51:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-17 15:51:26 +0100 |
commit | ab99f0656fabed8a62a8c6340be7d538cc7bf8d9 (patch) | |
tree | bb68ee1d0c743be23bba470f5d81ef11dc134182 /store/storetest/user_store.go | |
parent | 5786b0d6d57b90bbb0c262235dd9d19b497b5fae (diff) | |
download | chat-ab99f0656fabed8a62a8c6340be7d538cc7bf8d9.tar.gz chat-ab99f0656fabed8a62a8c6340be7d538cc7bf8d9.tar.bz2 chat-ab99f0656fabed8a62a8c6340be7d538cc7bf8d9.zip |
MM-11781: Basic Data Export Command Line. (#9296)
* MM-11781: Basic Data Export Command Line.
* ChannelStore new unit tests.
* TeamStore new unit tests.
* Unit test for new UserStore function.
* Unit tests for post store new methods.
* Review fixes.
* Fix duplicate command name.
Diffstat (limited to 'store/storetest/user_store.go')
-rw-r--r-- | store/storetest/user_store.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/store/storetest/user_store.go b/store/storetest/user_store.go index d1a373f9b..f3cc59946 100644 --- a/store/storetest/user_store.go +++ b/store/storetest/user_store.go @@ -51,6 +51,7 @@ func TestUserStore(t *testing.T, ss store.Store) { t.Run("AnalyticsGetSystemAdminCount", func(t *testing.T) { testUserStoreAnalyticsGetSystemAdminCount(t, ss) }) t.Run("GetProfilesNotInTeam", func(t *testing.T) { testUserStoreGetProfilesNotInTeam(t, ss) }) t.Run("ClearAllCustomRoleAssignments", func(t *testing.T) { testUserStoreClearAllCustomRoleAssignments(t, ss) }) + t.Run("GetAllAfter", func(t *testing.T) { testUserStoreGetAllAfter(t, ss) }) } func testUserStoreSave(t *testing.T, ss store.Store) { @@ -2164,3 +2165,35 @@ func testUserStoreClearAllCustomRoleAssignments(t *testing.T, ss store.Store) { require.Nil(t, r4.Err) assert.Equal(t, "", r4.Data.(*model.User).Roles) } + +func testUserStoreGetAllAfter(t *testing.T, ss store.Store) { + u1 := model.User{ + Email: MakeEmail(), + Username: model.NewId(), + Roles: "system_user system_admin system_post_all", + } + store.Must(ss.User().Save(&u1)) + + r1 := <-ss.User().GetAllAfter(10000, strings.Repeat("0", 26)) + require.Nil(t, r1.Err) + + d1 := r1.Data.([]*model.User) + + found := false + for _, u := range d1 { + if u.Id == u1.Id { + found = true + assert.Equal(t, u1.Id, u.Id) + assert.Equal(t, u1.Email, u.Email) + } + } + assert.True(t, found) + + r2 := <-ss.User().GetAllAfter(10000, u1.Id) + require.Nil(t, r2.Err) + + d2 := r2.Data.([]*model.User) + for _, u := range d2 { + assert.NotEqual(t, u1.Id, u.Id) + } +} |