diff --git a/commands/group_test.go b/commands/group_test.go index 83341a7c8..9d6f28707 100644 --- a/commands/group_test.go +++ b/commands/group_test.go @@ -272,3 +272,99 @@ func (s *MmctlUnitTestSuite) TestTeamGroupListCmd() { s.Require().Equal(printer.GetLines()[1], &group2) }) } + +func (s *MmctlUnitTestSuite) TestTeamGroupStatusCmd() { + s.Run("Should fail when team is not found", func() { + printer.Clean() + + teamID := "teamId" + arg := teamID + args := []string{arg} + cmd := &cobra.Command{} + + s.client. + EXPECT(). + GetTeam(teamID, ""). + Return(nil, &model.Response{Error: nil}). + Times(1) + + s.client. + EXPECT(). + GetTeamByName(teamID, ""). + Return(nil, &model.Response{Error: nil}). + Times(1) + + err := teamGroupStatusCmdF(s.client, cmd, args) + + s.Require().EqualError(err, "Unable to find team '"+args[0]+"'") + }) + + s.Run("Should show valid response when group constraints status for a team is not present", func() { + printer.Clean() + + teamID := "teamId" + arg := teamID + args := []string{arg} + cmd := &cobra.Command{} + team := &model.Team{Id: teamID} + + s.client. + EXPECT(). + GetTeam(teamID, ""). + Return(team, &model.Response{Error: nil}). + Times(1) + + err := teamGroupStatusCmdF(s.client, cmd, args) + + s.Require().Nil(err) + s.Require().Len(printer.GetErrorLines(), 0) + s.Require().Len(printer.GetLines(), 1) + s.Require().Equal(printer.GetLines()[0], "Disabled") + }) + + s.Run("Should show valid response when group constraints status for a team is enabled", func() { + printer.Clean() + + teamID := "teamId" + arg := teamID + args := []string{arg} + cmd := &cobra.Command{} + team := &model.Team{Id: teamID, GroupConstrained: model.NewBool(true)} + + s.client. + EXPECT(). + GetTeam(teamID, ""). + Return(team, &model.Response{Error: nil}). + Times(1) + + err := teamGroupStatusCmdF(s.client, cmd, args) + + s.Require().Nil(err) + s.Require().Len(printer.GetErrorLines(), 0) + s.Require().Len(printer.GetLines(), 1) + s.Require().Equal(printer.GetLines()[0], "Enabled") + }) + + s.Run("Should show valid response when group constraints status for a team is disabled", func() { + printer.Clean() + + teamID := "teamId" + arg := teamID + args := []string{arg} + cmd := &cobra.Command{} + team := &model.Team{Id: teamID, GroupConstrained: model.NewBool(false)} + + s.client. + EXPECT(). + GetTeam(teamID, ""). + Return(team, &model.Response{Error: nil}). + Times(1) + + err := teamGroupStatusCmdF(s.client, cmd, args) + + s.Require().Nil(err) + s.Require().Len(printer.GetErrorLines(), 0) + s.Require().Len(printer.GetLines(), 1) + s.Require().Equal(printer.GetLines()[0], "Disabled") + }) +} diff --git a/docs/mmctl_user_email.md b/docs/mmctl_user_email.md index 71b3f3d15..e531d8633 100644 --- a/docs/mmctl_user_email.md +++ b/docs/mmctl_user_email.md @@ -13,8 +13,7 @@ mmctl user email [user] [new email] [flags] ### Examples ``` - user email test user@example.com - user activate username + user email testuser user@example.com ``` ### Options