[MM-26532] Support "active" filter on profile search (#14923)
* Support "active" filter on profile search * Add tests for active user filter
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bec2f366a7
Коммит
11bc28b5fb
@@ -2245,6 +2245,35 @@ func TestGetRecentlyActiveUsersInTeam(t *testing.T) {
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
}
|
||||
|
||||
func TestGetActiveUsersInTeam(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
teamId := th.BasicTeam.Id
|
||||
|
||||
th.SystemAdminClient.UpdateUserActive(th.BasicUser2.Id, false)
|
||||
rusers, resp := th.Client.GetActiveUsersInTeam(teamId, 0, 60, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
require.NotZero(t, len(rusers))
|
||||
for _, u := range rusers {
|
||||
require.Zero(t, u.DeleteAt, "should not be deleted")
|
||||
require.NotEqual(t, th.BasicUser2.Id, "should not include deactivated user")
|
||||
CheckUserSanitization(t, u)
|
||||
}
|
||||
|
||||
rusers, resp = th.Client.GetActiveUsersInTeam(teamId, 0, 1, "")
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, rusers, 1, "should be 1 per page")
|
||||
|
||||
// Check case where we have supplied both active and inactive flags
|
||||
_, err := th.Client.DoApiGet("/users?inactive=true&active=true", "")
|
||||
require.NotNil(t, err)
|
||||
|
||||
th.Client.Logout()
|
||||
_, resp = th.Client.GetActiveUsersInTeam(teamId, 0, 1, "")
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
}
|
||||
|
||||
func TestGetUsersWithoutTeam(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Ссылка в новой задаче
Block a user