[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 удалений

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

@@ -30,7 +30,7 @@ func (s *MmctlE2ETestSuite) TestExportListCmdF() {
printer.Clean()
err := exportListCmdF(s.th.Client, &cobra.Command{}, nil)
s.Require().EqualError(err, "failed to list exports: : You do not have the appropriate permissions.")
s.Require().EqualError(err, "failed to list exports: You do not have the appropriate permissions.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -84,7 +84,7 @@ func (s *MmctlE2ETestSuite) TestExportDeleteCmdF() {
printer.Clean()
err := exportDeleteCmdF(s.th.Client, &cobra.Command{}, []string{exportName})
s.Require().EqualError(err, "failed to delete export: : You do not have the appropriate permissions.")
s.Require().EqualError(err, "failed to delete export: You do not have the appropriate permissions.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -130,7 +130,7 @@ func (s *MmctlE2ETestSuite) TestExportCreateCmdF() {
printer.Clean()
err := exportCreateCmdF(s.th.Client, &cobra.Command{}, nil)
s.Require().EqualError(err, "failed to create export process job: : You do not have the appropriate permissions.")
s.Require().EqualError(err, "failed to create export process job: You do not have the appropriate permissions.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -291,7 +291,7 @@ func (s *MmctlE2ETestSuite) TestExportJobShowCmdF() {
s.Require().Nil(appErr)
err := exportJobShowCmdF(s.th.Client, &cobra.Command{}, []string{job1.Id})
s.Require().EqualError(err, "failed to get export job: : You do not have the appropriate permissions.")
s.Require().EqualError(err, "failed to get export job: You do not have the appropriate permissions.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -300,7 +300,7 @@ func (s *MmctlE2ETestSuite) TestExportJobShowCmdF() {
printer.Clean()
err := exportJobShowCmdF(c, &cobra.Command{}, []string{model.NewId()})
s.Require().ErrorContains(err, "failed to get export job: : Unable to get the job.")
s.Require().ErrorContains(err, "failed to get export job: Unable to get the job.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -328,7 +328,7 @@ func (s *MmctlE2ETestSuite) TestExportJobListCmdF() {
cmd.Flags().Bool("all", false, "")
err := exportJobListCmdF(s.th.Client, cmd, nil)
s.Require().EqualError(err, "failed to get jobs: : You do not have the appropriate permissions.")
s.Require().EqualError(err, "failed to get jobs: You do not have the appropriate permissions.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -401,7 +401,7 @@ func (s *MmctlE2ETestSuite) TestExportJobCancelCmdF() {
time.Sleep(time.Millisecond)
err := exportJobCancelCmdF(s.th.Client, cmd, []string{job.Id})
s.Require().EqualError(err, "failed to get export job: : You do not have the appropriate permissions.")
s.Require().EqualError(err, "failed to get export job: You do not have the appropriate permissions.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -412,7 +412,7 @@ func (s *MmctlE2ETestSuite) TestExportJobCancelCmdF() {
cmd := &cobra.Command{}
err := exportJobCancelCmdF(c, cmd, []string{model.NewId()})
s.Require().ErrorContains(err, "failed to get export job: : Unable to get the job.")
s.Require().ErrorContains(err, "failed to get export job: Unable to get the job.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})