summaryrefslogtreecommitdiffstats
path: root/api4/team_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-05-18 09:13:23 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2018-05-18 09:13:23 -0400
commitc6cbce610043bb050f2c542412eb439dc22c4a88 (patch)
tree47f3570ca00e96cd356f93ba656ba990cbd246f0 /api4/team_test.go
parente591fcf3d8c61c3df7d1d8457ae7b72bfe3abf1b (diff)
downloadchat-c6cbce610043bb050f2c542412eb439dc22c4a88.tar.gz
chat-c6cbce610043bb050f2c542412eb439dc22c4a88.tar.bz2
chat-c6cbce610043bb050f2c542412eb439dc22c4a88.zip
Add config setting for API team deletion (#8800)
Diffstat (limited to 'api4/team_test.go')
-rw-r--r--api4/team_test.go27
1 files changed, 15 insertions, 12 deletions
diff --git a/api4/team_test.go b/api4/team_test.go
index 705ff603b..bf67d8fde 100644
--- a/api4/team_test.go
+++ b/api4/team_test.go
@@ -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)