Add config setting for API team deletion (#8800)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
e591fcf3d8
Коммит
c6cbce6100
@@ -540,22 +540,25 @@ func TestPermanentDeleteTeam(t *testing.T) {
|
||||
team := &model.Team{DisplayName: "DisplayName", Name: GenerateTestTeamName(), Email: th.GenerateTestEmail(), Type: model.TEAM_OPEN}
|
||||
team, _ = Client.CreateTeam(team)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableAPITeamDeletion = false })
|
||||
|
||||
// Does not error when deletion is disabled, just soft deletes
|
||||
ok, resp := Client.PermanentDeleteTeam(team.Id)
|
||||
CheckNoError(t, resp)
|
||||
assert.True(t, ok)
|
||||
|
||||
if !ok {
|
||||
t.Fatal("should have returned true")
|
||||
}
|
||||
|
||||
// The team is deleted in the background, its only soft deleted at this
|
||||
// time
|
||||
rteam, err := th.App.GetTeam(team.Id)
|
||||
if err != nil {
|
||||
t.Fatal("should have returned archived team")
|
||||
}
|
||||
if rteam.DeleteAt == 0 {
|
||||
t.Fatal("should have not set to zero")
|
||||
}
|
||||
assert.Nil(t, err)
|
||||
assert.True(t, rteam.DeleteAt > 0)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableAPITeamDeletion = true })
|
||||
|
||||
ok, resp = Client.PermanentDeleteTeam(team.Id)
|
||||
CheckNoError(t, resp)
|
||||
assert.True(t, ok)
|
||||
|
||||
_, err = th.App.GetTeam(team.Id)
|
||||
assert.NotNil(t, err)
|
||||
|
||||
ok, resp = Client.PermanentDeleteTeam("junk")
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
Ссылка в новой задаче
Block a user