From ab99f0656fabed8a62a8c6340be7d538cc7bf8d9 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Mon, 17 Sep 2018 15:51:26 +0100 Subject: 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. --- store/storetest/user_store.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'store/storetest/user_store.go') 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) + } +} -- cgit v1.2.3-1-g7c22