mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
PLT-6083: API to get users not in a specific team. (#5888)
This commit is contained in:
committed by
Joram Wilander
parent
6d6b813446
commit
a4764a5c10
@@ -897,6 +897,52 @@ func TestGetUsersInTeam(t *testing.T) {
|
||||
CheckNoError(t, resp)
|
||||
}
|
||||
|
||||
func TestGetUsersNotInTeam(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
defer TearDown()
|
||||
Client := th.Client
|
||||
teamId := th.BasicTeam.Id
|
||||
|
||||
rusers, resp := Client.GetUsersNotInTeam(teamId, 0, 60, "")
|
||||
CheckNoError(t, resp)
|
||||
for _, u := range rusers {
|
||||
CheckUserSanitization(t, u)
|
||||
}
|
||||
|
||||
rusers, resp = Client.GetUsersNotInTeam(teamId, 0, 60, resp.Etag)
|
||||
CheckEtag(t, rusers, resp)
|
||||
|
||||
rusers, resp = Client.GetUsersNotInTeam(teamId, 0, 1, "")
|
||||
CheckNoError(t, resp)
|
||||
if len(rusers) != 1 {
|
||||
t.Fatal("should be 1 per page")
|
||||
}
|
||||
|
||||
rusers, resp = Client.GetUsersNotInTeam(teamId, 1, 1, "")
|
||||
CheckNoError(t, resp)
|
||||
if len(rusers) != 1 {
|
||||
t.Fatal("should be 1 per page")
|
||||
}
|
||||
|
||||
rusers, resp = Client.GetUsersNotInTeam(teamId, 10000, 100, "")
|
||||
CheckNoError(t, resp)
|
||||
if len(rusers) != 0 {
|
||||
t.Fatal("should be no users")
|
||||
}
|
||||
|
||||
Client.Logout()
|
||||
_, resp = Client.GetUsersNotInTeam(teamId, 0, 60, "")
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
|
||||
user := th.CreateUser()
|
||||
Client.Login(user.Email, user.Password)
|
||||
_, resp = Client.GetUsersNotInTeam(teamId, 0, 60, "")
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
_, resp = th.SystemAdminClient.GetUsersNotInTeam(teamId, 0, 60, "")
|
||||
CheckNoError(t, resp)
|
||||
}
|
||||
|
||||
func TestGetUsersInChannel(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
defer TearDown()
|
||||
|
||||
Reference in New Issue
Block a user