updated modifyTeamsCmdF to return error instead of nil when encounting error (#26606)

Этот коммит содержится в:
Ezekiel
2024-04-10 13:32:41 +08:00
коммит произвёл GitHub
родитель 65c6717e6b
Коммит db2cfe953b
3 изменённых файлов: 31 добавлений и 14 удалений

Просмотреть файл

@@ -734,8 +734,10 @@ func (s *MmctlUnitTestSuite) TestModifyTeamsCmd() {
cmd.Flags().Bool("private", true, "")
err := modifyTeamsCmdF(s.client, cmd, []string{"team1"})
s.Require().Nil(err)
s.Require().Equal("Unable to find team 'team1'", printer.GetErrorLines()[0])
expectedError := "Unable to find team 'team1'"
s.Require().ErrorContains(err, expectedError)
s.Require().Equal(expectedError, printer.GetErrorLines()[0])
})
s.Run("Modify teams, set to private", func() {
@@ -823,8 +825,10 @@ func (s *MmctlUnitTestSuite) TestModifyTeamsCmd() {
cmd.Flags().Bool("public", true, "")
err := modifyTeamsCmdF(s.client, cmd, []string{"team1"})
s.Require().Nil(err)
s.Require().Equal("Unable to modify team 'team1' error: an error occurred modifying a team",
expectedError := "Unable to modify team 'team1' error: an error occurred modifying a team"
s.Require().ErrorContains(err, expectedError)
s.Require().Equal(expectedError,
printer.GetErrorLines()[0])
})
}