Fix missing errors in mmctl output (#30567)

Этот коммит содержится в:
Ben Schumacher
2025-03-28 09:30:41 +01:00
коммит произвёл GitHub
родитель 4156112f7c
Коммит 6c8235d031
7 изменённых файлов: 15 добавлений и 15 удалений

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

@@ -94,7 +94,7 @@ func (s *MmctlUnitTestSuite) TestUserActivateCmd() {
s.Require().Error(err)
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 1)
s.Require().Equal(fmt.Errorf("unable to change activation status of user: %v", mockUser.Id).Error(), printer.GetErrorLines()[0])
s.Require().Equal(fmt.Sprintf("unable to change activation status of user %v: mock error", mockUser.Id), printer.GetErrorLines()[0])
})
s.Run("Activate several users with unexistent ones and failed ones", func() {
@@ -170,7 +170,7 @@ func (s *MmctlUnitTestSuite) TestUserActivateCmd() {
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 2)
s.Require().Equal(fmt.Sprintf("1 error occurred:\n\t* user %s not found\n\n", emailArgs[1]), printer.GetErrorLines()[0])
s.Require().Equal(fmt.Sprintf("unable to change activation status of user: %v", mockUser3.Id), printer.GetErrorLines()[1])
s.Require().Equal(fmt.Sprintf("unable to change activation status of user %v: mock error", mockUser3.Id), printer.GetErrorLines()[1])
})
s.Run("shell completion", func() {
@@ -280,7 +280,7 @@ func (s *MmctlUnitTestSuite) TestDeactivateUserCmd() {
s.Require().Error(err)
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 1)
s.Require().Equal(fmt.Errorf("unable to change activation status of user: %v", mockUser.Id).Error(), printer.GetErrorLines()[0])
s.Require().Equal(fmt.Sprintf("unable to change activation status of user %v: mock error", mockUser.Id), printer.GetErrorLines()[0])
})
s.Run("Deactivate SSO user", func() {
@@ -381,7 +381,7 @@ func (s *MmctlUnitTestSuite) TestDeactivateUserCmd() {
s.Require().Equal("You must also deactivate user "+mockUser2.Id+" in the SSO provider or they will be reactivated on next login or sync.", printer.GetLines()[0])
s.Require().Len(printer.GetErrorLines(), 2)
s.Require().Equal(fmt.Sprintf("1 error occurred:\n\t* user %v not found\n\n", emailArgs[1]), printer.GetErrorLines()[0])
s.Require().Equal(fmt.Errorf("unable to change activation status of user: %v", mockUser3.Id).Error(), printer.GetErrorLines()[1])
s.Require().Equal(fmt.Sprintf("unable to change activation status of user %v: mock error", mockUser3.Id), printer.GetErrorLines()[1])
})
}