diff options
author | Zeger-Jan van de Weg <ZJvandeWeg@users.noreply.github.com> | 2017-06-15 14:13:18 +0200 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-06-15 08:13:18 -0400 |
commit | 0c04c5334fc89cf62a4bd3c1ce20469523a24026 (patch) | |
tree | 30b56cf82205ef5d739059ec1b3a24865e8d0fb3 /api4/team_test.go | |
parent | 98ac903fce24418538edbec77a218bcac9e20cd2 (diff) | |
download | chat-0c04c5334fc89cf62a4bd3c1ce20469523a24026.tar.gz chat-0c04c5334fc89cf62a4bd3c1ce20469523a24026.tar.bz2 chat-0c04c5334fc89cf62a4bd3c1ce20469523a24026.zip |
Add APIv4 endpoint to permanently delete teams (#6604)
Tests are added, however, it only tests the property if its soft deleted. In the
background it will be hard deleted, but that is untestable through a integration
test.
Diffstat (limited to 'api4/team_test.go')
-rw-r--r-- | api4/team_test.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/api4/team_test.go b/api4/team_test.go index 61d7dc331..2aee4ba5f 100644 --- a/api4/team_test.go +++ b/api4/team_test.go @@ -363,6 +363,39 @@ func TestSoftDeleteTeam(t *testing.T) { CheckNoError(t, resp) } +func TestPermanentDeleteTeam(t *testing.T) { + th := Setup().InitBasic().InitSystemAdmin() + defer TearDown() + Client := th.Client + + team := &model.Team{DisplayName: "DisplayName", Name: GenerateTestTeamName(), Email: GenerateTestEmail(), Type: model.TEAM_OPEN} + team, _ = Client.CreateTeam(team) + + ok, resp := Client.PermanentDeleteTeam(team.Id) + CheckNoError(t, resp) + + if !ok { + t.Fatal("should have returned true") + } + + // The team is deleted in the background, its only soft deleted at this + // time + rteam, err := 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") + } + + ok, resp = Client.PermanentDeleteTeam("junk") + CheckBadRequestStatus(t, resp) + + if ok { + t.Fatal("should have returned false") + } +} + func TestGetAllTeams(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer TearDown() |