[MM-56061] Only render where field in model.AppError when it's present (#25648)

* Only render where field in model.AppError when it's present

* Remove trailing comma from permission error
Этот коммит содержится в:
Ben Schumacher
2023-12-11 10:27:51 +01:00
коммит произвёл GitHub
родитель a54f927e3d
Коммит 5b6b425cfc
27 изменённых файлов: 150 добавлений и 106 удалений

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

@@ -55,7 +55,7 @@ func (s *MmctlE2ETestSuite) TestRenameTeamCmdF() {
err := renameTeamCmdF(s.th.Client, cmd, args)
s.Require().Error(err)
s.Len(printer.GetLines(), 0)
s.ErrorContains(err, "Cannot rename team '"+s.th.BasicTeam.Name+"', error : : You do not have the appropriate permissions.")
s.ErrorContains(err, "Cannot rename team '"+s.th.BasicTeam.Name+"', error : You do not have the appropriate permissions.")
})
}
@@ -86,7 +86,7 @@ func (s *MmctlE2ETestSuite) TestDeleteTeamsCmdF() {
_ = deleteTeamsCmdF(s.th.Client, cmd, args)
s.Len(printer.GetLines(), 0)
s.Len(printer.GetErrorLines(), 1)
s.Require().Equal("Unable to delete team '"+s.th.BasicTeam.Name+"' error: : You do not have the appropriate permissions.", printer.GetErrorLines()[0])
s.Require().Equal("Unable to delete team '"+s.th.BasicTeam.Name+"' error: You do not have the appropriate permissions.", printer.GetErrorLines()[0])
team, _ := s.th.App.GetTeam(s.th.BasicTeam.Id)
s.Equal(team.Name, s.th.BasicTeam.Name)
})
@@ -140,7 +140,7 @@ func (s *MmctlE2ETestSuite) TestDeleteTeamsCmdF() {
s.Require().Error(err)
s.Len(printer.GetLines(), 0)
s.Len(printer.GetErrorLines(), 1)
s.Equal("Unable to delete team '"+s.th.BasicTeam.Name+"' error: : Permanent team deletion feature is not enabled. Please contact your System Administrator.", printer.GetErrorLines()[0])
s.Equal("Unable to delete team '"+s.th.BasicTeam.Name+"' error: Permanent team deletion feature is not enabled. Please contact your System Administrator.", printer.GetErrorLines()[0])
// verify team still exists
team, _ := s.th.App.GetTeam(s.th.BasicTeam.Id)
@@ -185,7 +185,7 @@ func (s *MmctlE2ETestSuite) TestModifyTeamsCmdF() {
s.Require().NoError(err)
s.Require().Contains(
printer.GetErrorLines()[0],
fmt.Sprintf("Unable to modify team '%s' error: : You do not have the appropriate permissions.", s.th.BasicTeam.Name),
fmt.Sprintf("Unable to modify team '%s' error: You do not have the appropriate permissions.", s.th.BasicTeam.Name),
)
t, appErr := s.th.App.GetTeam(teamID)
s.Require().Nil(appErr)
@@ -202,7 +202,7 @@ func (s *MmctlE2ETestSuite) TestModifyTeamsCmdF() {
s.Require().NoError(err)
s.Require().Contains(
printer.GetErrorLines()[0],
fmt.Sprintf("Unable to modify team '%s' error: : You do not have the appropriate permissions.", s.th.BasicTeam.Name),
fmt.Sprintf("Unable to modify team '%s' error: You do not have the appropriate permissions.", s.th.BasicTeam.Name),
)
t, appErr := s.th.App.GetTeam(teamID)
s.Require().Nil(appErr)