Expose GroupConstrained flag where needed and add tests (#10604)
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
5db62c20c5
Коммит
4c52f91997
@@ -72,6 +72,18 @@ func TestCreateTeam(t *testing.T) {
|
||||
_, resp = Client.CreateTeam(rteam)
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
|
||||
th.LoginBasic()
|
||||
|
||||
// Test GroupConstrained flag
|
||||
groupConstrainedTeam := &model.Team{Name: GenerateTestUsername(), DisplayName: "Some Team", Type: model.TEAM_OPEN, GroupConstrained: model.NewBool(true)}
|
||||
rteam, resp = Client.CreateTeam(groupConstrainedTeam)
|
||||
CheckNoError(t, resp)
|
||||
CheckCreatedStatus(t, resp)
|
||||
|
||||
if *rteam.GroupConstrained != *groupConstrainedTeam.GroupConstrained {
|
||||
t.Fatal("GroupConstrained flags do not match")
|
||||
}
|
||||
|
||||
// Check the appropriate permissions are enforced.
|
||||
defaultRolePermissions := th.SaveDefaultRolePermissions()
|
||||
defer func() {
|
||||
@@ -81,7 +93,6 @@ func TestCreateTeam(t *testing.T) {
|
||||
th.RemovePermissionFromRole(model.PERMISSION_CREATE_TEAM.Id, model.SYSTEM_USER_ROLE_ID)
|
||||
th.AddPermissionToRole(model.PERMISSION_CREATE_TEAM.Id, model.SYSTEM_ADMIN_ROLE_ID)
|
||||
|
||||
th.LoginBasic()
|
||||
_, resp = Client.CreateTeam(team)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
}
|
||||
@@ -273,6 +284,17 @@ func TestUpdateTeam(t *testing.T) {
|
||||
t.Fatal("Update failed")
|
||||
}
|
||||
|
||||
// Test GroupConstrained flag
|
||||
team.GroupConstrained = model.NewBool(true)
|
||||
rteam, resp := Client.UpdateTeam(team)
|
||||
CheckNoError(t, resp)
|
||||
CheckOKStatus(t, resp)
|
||||
|
||||
if *rteam.GroupConstrained != *team.GroupConstrained {
|
||||
t.Fatal("GroupConstrained flags do not match")
|
||||
}
|
||||
team.GroupConstrained = nil
|
||||
|
||||
team.AllowOpenInvite = true
|
||||
uteam, resp = Client.UpdateTeam(team)
|
||||
CheckNoError(t, resp)
|
||||
@@ -411,6 +433,17 @@ func TestPatchTeam(t *testing.T) {
|
||||
t.Fatal("AllowOpenInvite did not update properly")
|
||||
}
|
||||
|
||||
// Test GroupConstrained flag
|
||||
patch.GroupConstrained = model.NewBool(true)
|
||||
rteam, resp = Client.PatchTeam(team.Id, patch)
|
||||
CheckNoError(t, resp)
|
||||
CheckOKStatus(t, resp)
|
||||
|
||||
if *rteam.GroupConstrained != *patch.GroupConstrained {
|
||||
t.Fatal("GroupConstrained flags do not match")
|
||||
}
|
||||
patch.GroupConstrained = nil
|
||||
|
||||
_, resp = Client.PatchTeam("junk", patch)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user