From 457a34c5f4cba44299eb289694cb0174e4eba7be Mon Sep 17 00:00:00 2001 From: Wasim Thabraze Date: Tue, 16 Oct 2018 00:18:18 +0530 Subject: [MM-12363] Added Team archive command to archive a team by name (#9565) * Added Team archive command to archive a team by name * Team archive command now uses SoftDelete method Team search and list command now shows archived teams with the term '(archived)' appended to them --- cmd/mattermost/commands/team_test.go | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'cmd/mattermost/commands/team_test.go') diff --git a/cmd/mattermost/commands/team_test.go b/cmd/mattermost/commands/team_test.go index 559198256..16ebb5a09 100644 --- a/cmd/mattermost/commands/team_test.go +++ b/cmd/mattermost/commands/team_test.go @@ -96,6 +96,25 @@ func TestListTeams(t *testing.T) { } } +func TestListArchivedTeams(t *testing.T) { + th := api4.Setup().InitBasic() + defer th.TearDown() + + id := model.NewId() + name := "name" + id + displayName := "Name " + id + + CheckCommand(t, "team", "create", "--name", name, "--display_name", displayName) + + CheckCommand(t, "team", "archive", name) + + output := CheckCommand(t, "team", "list", th.BasicTeam.Name, th.BasicUser.Email) + + if !strings.Contains(string(output), name+" (archived)") { + t.Fatal("should have archived team") + } +} + func TestSearchTeamsByName(t *testing.T) { th := api4.Setup().InitBasic() defer th.TearDown() @@ -129,3 +148,41 @@ func TestSearchTeamsByDisplayName(t *testing.T) { t.Fatal("should have the created team") } } + +func TestSearchArchivedTeamsByName(t *testing.T) { + th := api4.Setup().InitBasic() + defer th.TearDown() + + id := model.NewId() + name := "name" + id + displayName := "Name " + id + + CheckCommand(t, "team", "create", "--name", name, "--display_name", displayName) + + CheckCommand(t, "team", "archive", name) + + output := CheckCommand(t, "team", "search", name) + + if !strings.Contains(string(output), "(archived)") { + t.Fatal("should have archived team") + } +} + +func TestArchiveTeams(t *testing.T) { + th := api4.Setup().InitBasic() + defer th.TearDown() + + id := model.NewId() + name := "name" + id + displayName := "Name " + id + + CheckCommand(t, "team", "create", "--name", name, "--display_name", displayName) + + CheckCommand(t, "team", "archive", name) + + output := CheckCommand(t, "team", "list") + + if !strings.Contains(string(output), name+" (archived)") { + t.Fatal("should have archived team") + } +} -- cgit v1.2.3-1-g7c22