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

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

@@ -151,7 +151,7 @@ func (s *MmctlE2ETestSuite) TestListBotCmdF() {
err := botListCmdF(s.th.Client, cmd, []string{})
s.Require().Error(err)
s.Require().Equal("Failed to fetch bots: : You do not have the appropriate permissions.", err.Error())
s.Require().Equal("Failed to fetch bots: You do not have the appropriate permissions.", err.Error())
})
}

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

@@ -144,7 +144,7 @@ func (s *MmctlE2ETestSuite) TestSearchChannelCmd() {
err := searchChannelCmdF(c, cmd, []string{s.th.BasicChannel.Name})
s.Require().NotNil(err)
s.Require().ErrorContains(err, `: Channel does not exist.`)
s.Require().ErrorContains(err, `Channel does not exist.`)
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 0)
})
@@ -475,7 +475,7 @@ func (s *MmctlE2ETestSuite) TestChannelRenameCmd() {
s.Require().NotNil(err)
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 0)
s.Require().Equal(fmt.Sprintf("cannot rename channel \"%s\", error: : You do not have the appropriate permissions.", channelInit.Name), err.Error())
s.Require().Equal(fmt.Sprintf("cannot rename channel \"%s\", error: You do not have the appropriate permissions.", channelInit.Name), err.Error())
rchannel, err := s.th.App.GetChannel(s.th.Context, channel.Id)
s.Require().Nil(err)

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

@@ -98,7 +98,7 @@ func (s *MmctlE2ETestSuite) TestChannelUsersAddCmdF() {
s.Require().Nil(err)
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 1)
s.Require().Equal(fmt.Sprintf("Unable to add '%s' to %s. Error: : You do not have the appropriate permissions.", user.Id, channelName), printer.GetErrorLines()[0])
s.Require().Equal(fmt.Sprintf("Unable to add '%s' to %s. Error: You do not have the appropriate permissions.", user.Id, channelName), printer.GetErrorLines()[0])
})
s.Run("Add user to channel/Client", func() {

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

@@ -183,7 +183,7 @@ func (s *MmctlE2ETestSuite) TestArchiveCommandCmdF() {
err := archiveCommandCmdF(c, &cobra.Command{}, []string{nonexistentCommandID})
s.Require().NotNil(err)
s.Require().Equal(fmt.Sprintf("Unable to archive command '%s' error: : Sorry, we could not find the page., There doesn't appear to be an api call for the url='/api/v4/commands/nonexistent-command-id'. Typo? are you missing a team_id or user_id as part of the url?", nonexistentCommandID), err.Error())
s.Require().Equal(fmt.Sprintf("Unable to archive command '%s' error: Sorry, we could not find the page., There doesn't appear to be an api call for the url='/api/v4/commands/nonexistent-command-id'. Typo? are you missing a team_id or user_id as part of the url?", nonexistentCommandID), err.Error())
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 0)
})
@@ -242,7 +242,7 @@ func (s *MmctlE2ETestSuite) TestArchiveCommandCmdF() {
err := archiveCommandCmdF(s.th.Client, &cobra.Command{}, []string{command.Id})
s.Require().NotNil(err)
s.Require().Equal(fmt.Sprintf("Unable to archive command '%s' error: : Unable to get the command.", command.Id), err.Error())
s.Require().Equal(fmt.Sprintf("Unable to archive command '%s' error: Unable to get the command.", command.Id), err.Error())
rcommand, err := s.th.App.GetCommand(command.Id)
s.Require().Nil(err)

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

@@ -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())
})

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

@@ -31,7 +31,7 @@ func (s *MmctlE2ETestSuite) TestExtractRunCmdF() {
err := extractRunCmdF(s.th.Client, cmd, []string{})
s.Require().NotNil(err)
s.Require().Equal("failed to create content extraction job: : You do not have the appropriate permissions.", err.Error())
s.Require().Equal("failed to create content extraction job: You do not have the appropriate permissions.", err.Error())
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -88,7 +88,7 @@ func (s *MmctlE2ETestSuite) TestExtractJobShowCmdF() {
err := extractJobShowCmdF(s.th.Client, &cobra.Command{}, []string{job1.Id})
s.Require().NotNil(err)
s.Require().Equal("failed to get content extraction job: : You do not have the appropriate permissions.", err.Error())
s.Require().Equal("failed to get content extraction job: You do not have the appropriate permissions.", err.Error())
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -98,7 +98,7 @@ func (s *MmctlE2ETestSuite) TestExtractJobShowCmdF() {
err := extractJobShowCmdF(c, &cobra.Command{}, []string{model.NewId()})
s.Require().NotNil(err)
s.Require().ErrorContains(err, "failed to get content extraction job: : Unable to get the job.")
s.Require().ErrorContains(err, "failed to get content extraction job: Unable to get the job.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -127,7 +127,7 @@ func (s *MmctlE2ETestSuite) TestExtractJobListCmdF() {
err := extractJobListCmdF(s.th.Client, cmd, nil)
s.Require().NotNil(err)
s.Require().Equal("failed to get jobs: : You do not have the appropriate permissions.", err.Error())
s.Require().Equal("failed to get jobs: You do not have the appropriate permissions.", err.Error())
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})

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

@@ -537,7 +537,7 @@ func (s *MmctlE2ETestSuite) TestUserGroupRestoreCmd() {
s.th.RemovePermissionFromRole(model.PermissionRestoreCustomGroup.Id, model.SystemUserRoleId)
err := userGroupRestoreCmdF(s.th.Client, &cobra.Command{}, []string{group.Id})
s.Require().NotNil(err)
s.Require().Equal(err.Error(), ": You do not have the appropriate permissions.")
s.Require().Equal(err.Error(), "You do not have the appropriate permissions.")
s.th.AddPermissionToRole(model.PermissionRestoreCustomGroup.Id, model.SystemUserRoleId)
err = userGroupRestoreCmdF(s.th.Client, &cobra.Command{}, []string{group.Id})
@@ -550,7 +550,7 @@ func (s *MmctlE2ETestSuite) TestUserGroupRestoreCmd() {
printer.Clean()
err = userGroupRestoreCmdF(s.th.Client, &cobra.Command{}, []string{group.Id})
s.Require().NotNil(err)
s.Require().Equal(err.Error(), ": no matching group found")
s.Require().Equal(err.Error(), "no matching group found")
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 0)
})

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

@@ -27,7 +27,7 @@ func (s *MmctlE2ETestSuite) TestImportUploadCmdF() {
err := importUploadCmdF(s.th.Client, &cobra.Command{}, []string{importFilePath})
s.Require().NotNil(err)
s.Require().Equal("failed to create upload session: : You do not have the appropriate permissions.", err.Error())
s.Require().Equal("failed to create upload session: You do not have the appropriate permissions.", err.Error())
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -98,7 +98,7 @@ func (s *MmctlE2ETestSuite) TestImportProcessCmdF() {
err := importProcessCmdF(s.th.Client, &cobra.Command{}, []string{"importName"})
s.Require().NotNil(err)
s.Require().Equal("failed to create import process job: : You do not have the appropriate permissions.", err.Error())
s.Require().Equal("failed to create import process job: You do not have the appropriate permissions.", err.Error())
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -138,7 +138,7 @@ func (s *MmctlE2ETestSuite) TestImportListAvailableCmdF() {
err := importListAvailableCmdF(s.th.Client, &cobra.Command{}, nil)
s.Require().NotNil(err)
s.Require().ErrorContains(err, "failed to list imports: : You do not have the appropriate permissions.")
s.Require().ErrorContains(err, "failed to list imports: You do not have the appropriate permissions.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -268,7 +268,7 @@ func (s *MmctlE2ETestSuite) TestImportJobShowCmdF() {
err := importJobShowCmdF(s.th.Client, &cobra.Command{}, []string{job1.Id})
s.Require().NotNil(err)
s.Require().ErrorContains(err, "failed to get import job: : You do not have the appropriate permissions.")
s.Require().ErrorContains(err, "failed to get import job: You do not have the appropriate permissions.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -278,7 +278,7 @@ func (s *MmctlE2ETestSuite) TestImportJobShowCmdF() {
err := importJobShowCmdF(c, &cobra.Command{}, []string{model.NewId()})
s.Require().NotNil(err)
s.Require().ErrorContains(err, "failed to get import job: : Unable to get the job.")
s.Require().ErrorContains(err, "failed to get import job: Unable to get the job.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})
@@ -307,7 +307,7 @@ func (s *MmctlE2ETestSuite) TestImportJobListCmdF() {
err := importJobListCmdF(s.th.Client, cmd, nil)
s.Require().NotNil(err)
s.Require().ErrorContains(err, "failed to get jobs: : You do not have the appropriate permissions.")
s.Require().ErrorContains(err, "failed to get jobs: You do not have the appropriate permissions.")
s.Require().Empty(printer.GetLines())
s.Require().Empty(printer.GetErrorLines())
})

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

@@ -199,7 +199,7 @@ func (s *MmctlE2ETestSuite) TestPluginInstallURLCmd() {
defer removePluginIfInstalled(s.th.Client, s, jiraPluginID)
var expected error
expected = multierror.Append(expected, errors.New(": You do not have the appropriate permissions.")) //nolint:revive
expected = multierror.Append(expected, errors.New("You do not have the appropriate permissions.")) //nolint:revive
err := pluginInstallURLCmdF(s.th.Client, &cobra.Command{}, []string{jiraURL})
s.Require().EqualError(err, expected.Error())
s.Require().Len(printer.GetLines(), 0)
@@ -218,7 +218,7 @@ func (s *MmctlE2ETestSuite) TestPluginInstallURLCmd() {
const pluginURL = "https://plugins-store.test.mattermost.com/release/mattermost-nonexistent-plugin-v2.0.0.tar.gz"
var expected error
expected = multierror.Append(expected, errors.New(": An error occurred while downloading the plugin.")) //nolint:revive
expected = multierror.Append(expected, errors.New("An error occurred while downloading the plugin.")) //nolint:revive
err := pluginInstallURLCmdF(c, &cobra.Command{}, []string{pluginURL})
s.Require().EqualError(err, expected.Error())
@@ -244,7 +244,7 @@ func (s *MmctlE2ETestSuite) TestPluginInstallURLCmd() {
s.Require().Equal(jiraPluginID, printer.GetLines()[0].(*model.Manifest).Id)
var expected error
expected = multierror.Append(expected, errors.New(": Unable to install plugin. A plugin with the same ID is already installed.")) //nolint:revive
expected = multierror.Append(expected, errors.New("Unable to install plugin. A plugin with the same ID is already installed.")) //nolint:revive
err = pluginInstallURLCmdF(c, &cobra.Command{}, []string{jiraURL})
s.Require().EqualError(err, expected.Error())
s.Require().Len(printer.GetLines(), 1)

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

@@ -119,7 +119,7 @@ func (s *MmctlE2ETestSuite) TestPluginMarketplaceListCmd() {
err := pluginMarketplaceListCmdF(s.th.Client, &cobra.Command{}, nil)
s.Require().ErrorContains(err, "Failed to fetch plugins: : You do not have the appropriate permissions.")
s.Require().ErrorContains(err, "Failed to fetch plugins: You do not have the appropriate permissions.")
s.Require().Empty(printer.GetErrorLines())
s.Require().Empty(printer.GetLines())
})

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

@@ -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)

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

@@ -70,7 +70,7 @@ func (s *MmctlE2ETestSuite) TestTokenGenerateForUserCmd() {
s.Require().Len(printer.GetErrorLines(), 0)
s.Require().ErrorContains(
err,
fmt.Sprintf(`could not create token for %q: : You do not have the appropriate permissions.`, user.Email),
fmt.Sprintf(`could not create token for %q: You do not have the appropriate permissions.`, user.Email),
)
userTokens, appErr := s.th.App.GetUserAccessTokensForUser(user.Id, 0, 1)
s.Require().Nil(appErr)

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

@@ -242,7 +242,7 @@ func (s *MmctlE2ETestSuite) TestUserInviteCmdf() {
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 1)
s.Require().Equal(
fmt.Sprintf("Unable to invite user with email %s to team %s. Error: : Email invitations are disabled.",
fmt.Sprintf("Unable to invite user with email %s to team %s. Error: Email invitations are disabled.",
s.th.BasicUser.Email,
s.th.BasicTeam.Name,
),
@@ -270,7 +270,7 @@ func (s *MmctlE2ETestSuite) TestUserInviteCmdf() {
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 1)
s.Require().Equal(
fmt.Sprintf(`Unable to invite user with email %s to team %s. Error: : The following email addresses do not belong to an accepted domain: %s. Please contact your System Administrator for details.`,
fmt.Sprintf(`Unable to invite user with email %s to team %s. Error: The following email addresses do not belong to an accepted domain: %s. Please contact your System Administrator for details.`,
user.Email,
team.Name,
user.Email,
@@ -337,7 +337,7 @@ func (s *MmctlE2ETestSuite) TestResetUserMfaCmd() {
var expected error
expected = multierror.Append(
expected, fmt.Errorf(`unable to reset user %q MFA. Error: : You do not have the appropriate permissions.`, user.Id), //nolint:revive
expected, fmt.Errorf(`unable to reset user %q MFA. Error: You do not have the appropriate permissions.`, user.Id), //nolint:revive
)
@@ -368,7 +368,7 @@ func (s *MmctlE2ETestSuite) TestVerifyUserEmailWithoutTokenCmd() {
var expected error
expected = multierror.Append(
expected, fmt.Errorf("unable to verify user "+user.Id+" email: : You do not have the appropriate permissions."),
expected, fmt.Errorf("unable to verify user "+user.Id+" email: You do not have the appropriate permissions."),
)
s.Require().EqualError(err, expected.Error())
@@ -452,7 +452,7 @@ func (s *MmctlE2ETestSuite) TestCreateUserCmd() {
cmd.Flags().Bool("system-admin", true, "")
err := userCreateCmdF(s.th.Client, cmd, []string{})
s.EqualError(err, "Unable to update user roles. Error: : You do not have the appropriate permissions.")
s.EqualError(err, "Unable to update user roles. Error: You do not have the appropriate permissions.")
s.Require().Empty(printer.GetLines())
user, err := s.th.App.GetUserByEmail(email)
s.Require().Nil(err)
@@ -541,7 +541,7 @@ func (s *MmctlE2ETestSuite) TestUpdateUserEmailCmd() {
printer.Clean()
newEmail := "basicuser2-change@fakedomain.com"
err := updateUserEmailCmdF(s.th.Client, &cobra.Command{}, []string{s.th.BasicUser2.Id, newEmail})
s.Require().EqualError(err, ": You do not have the appropriate permissions.")
s.Require().EqualError(err, "You do not have the appropriate permissions.")
u, err := s.th.App.GetUser(s.th.BasicUser2.Id)
s.Require().Nil(err)
@@ -553,7 +553,7 @@ func (s *MmctlE2ETestSuite) TestUpdateUserEmailCmd() {
newEmail := "basicuser-change@fakedomain.com"
err := updateUserEmailCmdF(s.th.Client, &cobra.Command{}, []string{s.th.BasicUser.Id, newEmail})
s.Require().EqualError(err, ": Invalid or missing password in request body.")
s.Require().EqualError(err, "Invalid or missing password in request body.")
})
}
@@ -580,7 +580,7 @@ func (s *MmctlE2ETestSuite) TestUpdateUsernameCmd() {
printer.Clean()
newUsername := "basicusernamechange"
err := updateUsernameCmdF(s.th.Client, &cobra.Command{}, []string{s.th.BasicUser2.Id, newUsername})
s.Require().EqualError(err, ": You do not have the appropriate permissions.")
s.Require().EqualError(err, "You do not have the appropriate permissions.")
u, err := s.th.App.GetUser(s.th.BasicUser2.Id)
s.Require().Nil(err)
@@ -675,7 +675,7 @@ func (s *MmctlE2ETestSuite) TestDeleteUsersCmd() {
s.Require().Nil(err)
s.Len(printer.GetLines(), 0)
s.Len(printer.GetErrorLines(), 1)
s.Require().Equal(fmt.Sprintf("Unable to delete user '%s' error: : You do not have the appropriate permissions.", newUser.Username), printer.GetErrorLines()[0])
s.Require().Equal(fmt.Sprintf("Unable to delete user '%s' error: You do not have the appropriate permissions.", newUser.Username), printer.GetErrorLines()[0])
// expect user not deleted
user, err := s.th.App.GetUser(newUser.Id)
@@ -701,7 +701,7 @@ func (s *MmctlE2ETestSuite) TestDeleteUsersCmd() {
s.Require().Nil(err)
s.Len(printer.GetLines(), 0)
s.Len(printer.GetErrorLines(), 1)
s.Require().Equal(fmt.Sprintf("Unable to delete user '%s' error: : Permanent user deletion feature is not enabled. Please contact your System Administrator.", newUser.Username), printer.GetErrorLines()[0])
s.Require().Equal(fmt.Sprintf("Unable to delete user '%s' error: Permanent user deletion feature is not enabled. Please contact your System Administrator.", newUser.Username), printer.GetErrorLines()[0])
// expect user not deleted
user, err := s.th.App.GetUser(newUser.Id)
@@ -793,7 +793,7 @@ func (s *MmctlE2ETestSuite) TestUserConvertCmdF() {
_ = userConvertCmdF(s.th.Client, cmd, []string{email})
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 1)
s.Equal(": You do not have the appropriate permissions.", printer.GetErrorLines()[0])
s.Equal("You do not have the appropriate permissions.", printer.GetErrorLines()[0])
})
s.RunForSystemAdminAndLocal("Valid bot to user convert", func(c client.Client) {
@@ -826,7 +826,7 @@ func (s *MmctlE2ETestSuite) TestUserConvertCmdF() {
err := userConvertCmdF(s.th.Client, cmd, []string{bot.Username})
s.Require().Error(err)
s.EqualError(err, ": You do not have the appropriate permissions.")
s.EqualError(err, "You do not have the appropriate permissions.")
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 0)
})
@@ -940,7 +940,7 @@ func (s *MmctlE2ETestSuite) TestPromoteGuestToUserCmd() {
s.Require().Nil(err)
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 1)
s.Require().Equal(fmt.Sprintf("unable to promote guest %s: %s", user.Email, ": You do not have the appropriate permissions."), printer.GetErrorLines()[0])
s.Require().Equal(fmt.Sprintf("unable to promote guest %s: You do not have the appropriate permissions.", user.Email), printer.GetErrorLines()[0])
})
}
@@ -970,7 +970,7 @@ func (s *MmctlE2ETestSuite) TestDemoteUserToGuestCmd() {
s.Require().NotNil(err)
s.Require().Len(printer.GetLines(), 0)
s.Require().Len(printer.GetErrorLines(), 1)
s.Require().Equal(fmt.Sprintf("unable to demote user %s: %s", user.Email, ": You do not have the appropriate permissions."), printer.GetErrorLines()[0])
s.Require().Equal(fmt.Sprintf("unable to demote user %s: You do not have the appropriate permissions.", user.Email), printer.GetErrorLines()[0])
})
}