summaryrefslogtreecommitdiffstats
path: root/cmd/mattermost/commands/team_test.go
diff options
context:
space:
mode:
authorWasim Thabraze <wasim@thabraze.me>2018-10-03 13:01:53 +0530
committerJesús Espino <jespinog@gmail.com>2018-10-03 09:31:53 +0200
commitb6835ab984aece679cb0d6bea548d3f2ed1c9af2 (patch)
tree1c313d2a07019944b1a4dafcccee115d896ec322 /cmd/mattermost/commands/team_test.go
parent2945e8a2b0ce9306bb049e65eb2410038e0fa18c (diff)
downloadchat-b6835ab984aece679cb0d6bea548d3f2ed1c9af2.tar.gz
chat-b6835ab984aece679cb0d6bea548d3f2ed1c9af2.tar.bz2
chat-b6835ab984aece679cb0d6bea548d3f2ed1c9af2.zip
[MM-12367] Added CLI command 'team search' (#9512)
* Added 'search' sub-command for the command 'team' to search across teams with name * Addressed code review * Moved 'removeDuplicatesAndSortTeams' function to team.go Addressed more code reviews * Added unit test case for team search command * Added unit test case to test searching of teams by display name
Diffstat (limited to 'cmd/mattermost/commands/team_test.go')
-rw-r--r--cmd/mattermost/commands/team_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/cmd/mattermost/commands/team_test.go b/cmd/mattermost/commands/team_test.go
index 20e04bdc9..559198256 100644
--- a/cmd/mattermost/commands/team_test.go
+++ b/cmd/mattermost/commands/team_test.go
@@ -95,3 +95,37 @@ func TestListTeams(t *testing.T) {
t.Fatal("should have the created team")
}
}
+
+func TestSearchTeamsByName(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)
+
+ output := CheckCommand(t, "team", "search", name)
+
+ if !strings.Contains(string(output), name) {
+ t.Fatal("should have the created team")
+ }
+}
+
+func TestSearchTeamsByDisplayName(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)
+
+ output := CheckCommand(t, "team", "search", displayName)
+
+ if !strings.Contains(string(output), name) {
+ t.Fatal("should have the created team")
+ }
+}