MM-54502 - Update regex to force first character to be alpha (#24675)
Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5bfb32c504
Коммит
08ed72f060
@@ -19,14 +19,14 @@ func (s *MmctlE2ETestSuite) TestListBotCmdF() {
|
||||
s.RunForSystemAdminAndLocal("List Bot", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
bot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: s.th.BasicUser.Id})
|
||||
bot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: s.th.BasicUser.Id})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteBot(s.th.Context, bot.UserId)
|
||||
s.Require().Nil(err)
|
||||
}()
|
||||
|
||||
deletedBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: s.th.BasicUser.Id})
|
||||
deletedBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: s.th.BasicUser.Id})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteBot(s.th.Context, deletedBot.UserId)
|
||||
@@ -49,21 +49,21 @@ func (s *MmctlE2ETestSuite) TestListBotCmdF() {
|
||||
s.RunForSystemAdminAndLocal("List Bot only orphaned", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId(), DeleteAt: 1})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId(), DeleteAt: 1})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteUser(s.th.Context, user)
|
||||
s.Require().Nil(err)
|
||||
}()
|
||||
|
||||
bot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: s.th.BasicUser.Id})
|
||||
bot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: s.th.BasicUser.Id})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteBot(s.th.Context, bot.UserId)
|
||||
s.Require().Nil(err)
|
||||
}()
|
||||
|
||||
deletedBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: user.Id})
|
||||
deletedBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: user.Id})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteBot(s.th.Context, deletedBot.UserId)
|
||||
@@ -73,7 +73,7 @@ func (s *MmctlE2ETestSuite) TestListBotCmdF() {
|
||||
deletedBot, appErr = s.th.App.UpdateBotActive(s.th.Context, deletedBot.UserId, false)
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
orphanBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: user.Id})
|
||||
orphanBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: user.Id})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteBot(s.th.Context, orphanBot.UserId)
|
||||
@@ -96,28 +96,28 @@ func (s *MmctlE2ETestSuite) TestListBotCmdF() {
|
||||
s.RunForSystemAdminAndLocal("List all Bots", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId(), DeleteAt: 1})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId(), DeleteAt: 1})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteUser(s.th.Context, user)
|
||||
s.Require().Nil(err)
|
||||
}()
|
||||
|
||||
bot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: s.th.BasicUser2.Id})
|
||||
bot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: s.th.BasicUser2.Id})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteBot(s.th.Context, bot.UserId)
|
||||
s.Require().Nil(err)
|
||||
}()
|
||||
|
||||
orphanBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: user.Id})
|
||||
orphanBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: user.Id})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteBot(s.th.Context, orphanBot.UserId)
|
||||
s.Require().Nil(err)
|
||||
}()
|
||||
|
||||
deletedBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: s.th.BasicUser2.Id})
|
||||
deletedBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: s.th.BasicUser2.Id})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteBot(s.th.Context, deletedBot.UserId)
|
||||
@@ -159,13 +159,13 @@ func (s *MmctlE2ETestSuite) TestBotEnableCmd() {
|
||||
s.SetupTestHelper().InitBasic()
|
||||
s.th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableBotAccountCreation = true })
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
s.RunForSystemAdminAndLocal("enable a bot", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: user.Id})
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: user.Id})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
_, appErr = s.th.App.UpdateBotActive(s.th.Context, newBot.UserId, false)
|
||||
@@ -191,7 +191,7 @@ func (s *MmctlE2ETestSuite) TestBotEnableCmd() {
|
||||
s.Run("enable a bot without permissions", func() {
|
||||
printer.Clean()
|
||||
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: user.Id})
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: user.Id})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
_, appErr = s.th.App.UpdateBotActive(s.th.Context, newBot.UserId, false)
|
||||
@@ -219,7 +219,7 @@ func (s *MmctlE2ETestSuite) TestBotEnableCmd() {
|
||||
s.RunForSystemAdminAndLocal("enable an already enabled bot", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: user.Id})
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: user.Id})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
_, appErr = s.th.App.UpdateBotActive(s.th.Context, newBot.UserId, true)
|
||||
@@ -247,13 +247,13 @@ func (s *MmctlE2ETestSuite) TestBotDisableCmd() {
|
||||
s.SetupTestHelper().InitBasic()
|
||||
s.th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableBotAccountCreation = true })
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
s.RunForSystemAdminAndLocal("disable a bot", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: user.Id})
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: user.Id})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
_, appErr = s.th.App.UpdateBotActive(s.th.Context, newBot.UserId, true)
|
||||
@@ -277,7 +277,7 @@ func (s *MmctlE2ETestSuite) TestBotDisableCmd() {
|
||||
s.Run("disable a bot without permissions", func() {
|
||||
printer.Clean()
|
||||
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: user.Id})
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: user.Id})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
_, appErr = s.th.App.UpdateBotActive(s.th.Context, newBot.UserId, true)
|
||||
@@ -305,7 +305,7 @@ func (s *MmctlE2ETestSuite) TestBotDisableCmd() {
|
||||
s.RunForSystemAdminAndLocal("disable an already disabled bot", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: user.Id})
|
||||
newBot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: user.Id})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
_, appErr = s.th.App.UpdateBotActive(s.th.Context, newBot.UserId, false)
|
||||
@@ -333,21 +333,21 @@ func (s *MmctlE2ETestSuite) TestBotAssignCmdF() {
|
||||
s.RunForSystemAdminAndLocal("Assign Bot", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
botOwner, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
botOwner, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteUser(s.th.Context, botOwner)
|
||||
s.Require().Nil(err)
|
||||
}()
|
||||
|
||||
newBotOwner, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
newBotOwner, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteUser(s.th.Context, newBotOwner)
|
||||
s.Require().Nil(err)
|
||||
}()
|
||||
|
||||
bot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: botOwner.Id})
|
||||
bot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: botOwner.Id})
|
||||
s.Require().Nil(appErr)
|
||||
s.Require().Equal(bot.OwnerId, botOwner.Id)
|
||||
defer func() {
|
||||
@@ -366,21 +366,21 @@ func (s *MmctlE2ETestSuite) TestBotAssignCmdF() {
|
||||
s.Run("Assign Bot without permission", func() {
|
||||
printer.Clean()
|
||||
|
||||
botOwner, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
botOwner, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteUser(s.th.Context, botOwner)
|
||||
s.Require().Nil(err)
|
||||
}()
|
||||
|
||||
newBotOwner, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
newBotOwner, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
err := s.th.App.PermanentDeleteUser(s.th.Context, newBotOwner)
|
||||
s.Require().Nil(err)
|
||||
}()
|
||||
|
||||
bot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewId(), OwnerId: botOwner.Id})
|
||||
bot, appErr := s.th.App.CreateBot(s.th.Context, &model.Bot{Username: model.NewUsername(), OwnerId: botOwner.Id})
|
||||
s.Require().Nil(appErr)
|
||||
s.Require().Equal(bot.OwnerId, botOwner.Id)
|
||||
defer func() {
|
||||
|
||||
@@ -324,7 +324,7 @@ func (s *MmctlE2ETestSuite) TestDeleteChannelsCmd() {
|
||||
s.th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableAPIChannelDeletion = true })
|
||||
defer s.th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableAPIChannelDeletion = *previousConfig })
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
team, appErr := s.th.App.CreateTeam(s.th.Context, &model.Team{
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
func (s *MmctlE2ETestSuite) TestChannelUsersAddCmdF() {
|
||||
s.SetupTestHelper().InitBasic()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
_, _, appErr = s.th.App.AddUserToTeam(s.th.Context, s.th.BasicTeam.Id, user.Id, "")
|
||||
@@ -151,7 +151,7 @@ func (s *MmctlE2ETestSuite) TestChannelUsersAddCmdF() {
|
||||
func (s *MmctlE2ETestSuite) TestChannelUsersRemoveCmd() {
|
||||
s.SetupTestHelper().InitBasic()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
_, _, appErr = s.th.App.AddUserToTeam(s.th.Context, s.th.BasicTeam.Id, user.Id, "")
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
func (s *MmctlE2ETestSuite) TestAssignUsersCmd() {
|
||||
s.SetupEnterpriseTestHelper().InitBasic()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
s.Run("MM-T3721 Should not allow normal user to assign a role", func() {
|
||||
@@ -68,7 +68,7 @@ func (s *MmctlE2ETestSuite) TestAssignUsersCmd() {
|
||||
func (s *MmctlE2ETestSuite) TestUnassignUsersCmd() {
|
||||
s.SetupEnterpriseTestHelper().InitBasic()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
s.Run("MM-T3965 Should not allow normal user to unassign a user from a role", func() {
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
func (s *MmctlE2ETestSuite) TestTeamUserAddCmd() {
|
||||
s.SetupTestHelper().InitBasic()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
team, appErr := s.th.App.CreateTeam(s.th.Context, &model.Team{
|
||||
@@ -171,7 +171,7 @@ func (s *MmctlE2ETestSuite) TestTeamUsersRemoveCmdF() {
|
||||
s.RunForSystemAdminAndLocal("Remove user from team", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
team := model.Team{
|
||||
@@ -197,7 +197,7 @@ func (s *MmctlE2ETestSuite) TestTeamUsersRemoveCmdF() {
|
||||
s.RunForSystemAdminAndLocal("Remove user from non-existent team", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
nonexistentTeamName := model.NewId()
|
||||
@@ -211,7 +211,7 @@ func (s *MmctlE2ETestSuite) TestTeamUsersRemoveCmdF() {
|
||||
s.Run("Remove user from team without permissions", func() {
|
||||
printer.Clean()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
team := model.Team{
|
||||
|
||||
@@ -25,7 +25,7 @@ func (s *MmctlE2ETestSuite) TestTokenGenerateForUserCmd() {
|
||||
s.RunForSystemAdminAndLocal("Generate token for user", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
err := generateTokenForAUserCmdF(c, &cobra.Command{}, []string{user.Email, tokenDescription})
|
||||
@@ -61,7 +61,7 @@ func (s *MmctlE2ETestSuite) TestTokenGenerateForUserCmd() {
|
||||
s.Run("Generate token without permission", func() {
|
||||
printer.Clean()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
err := generateTokenForAUserCmdF(s.th.Client, &cobra.Command{}, []string{user.Email, tokenDescription})
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
func (s *MmctlE2ETestSuite) TestUserActivateCmd() {
|
||||
s.SetupTestHelper().InitBasic()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
s.RunForSystemAdminAndLocal("Activate user", func(c client.Client) {
|
||||
@@ -69,7 +69,7 @@ func (s *MmctlE2ETestSuite) TestUserActivateCmd() {
|
||||
func (s *MmctlE2ETestSuite) TestUserDeactivateCmd() {
|
||||
s.SetupTestHelper().InitBasic()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
s.RunForSystemAdminAndLocal("Deactivate user", func(c client.Client) {
|
||||
@@ -370,7 +370,7 @@ func (s *MmctlE2ETestSuite) TestUserInviteCmdf() {
|
||||
func (s *MmctlE2ETestSuite) TestResetUserMfaCmd() {
|
||||
s.SetupTestHelper().InitBasic()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId(), MfaActive: true, MfaSecret: "secret"})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId(), MfaActive: true, MfaSecret: "secret"})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
s.RunForSystemAdminAndLocal("Reset user mfa", func(c client.Client) {
|
||||
@@ -400,7 +400,7 @@ func (s *MmctlE2ETestSuite) TestResetUserMfaCmd() {
|
||||
s.th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = *previousVal })
|
||||
}()
|
||||
|
||||
userMfaInactive, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId(), MfaActive: false})
|
||||
userMfaInactive, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId(), MfaActive: false})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
err := resetUserMfaCmdF(c, &cobra.Command{}, []string{userMfaInactive.Email})
|
||||
@@ -436,7 +436,7 @@ func (s *MmctlE2ETestSuite) TestResetUserMfaCmd() {
|
||||
func (s *MmctlE2ETestSuite) TestVerifyUserEmailWithoutTokenCmd() {
|
||||
s.SetupTestHelper().InitBasic()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
s.RunForSystemAdminAndLocal("Verify user email without token", func(c client.Client) {
|
||||
@@ -500,7 +500,7 @@ func (s *MmctlE2ETestSuite) TestCreateUserCmd() {
|
||||
|
||||
s.RunForAllClients("Should not create a user w/o email", func(c client.Client) {
|
||||
printer.Clean()
|
||||
username := model.NewId()
|
||||
username := model.NewUsername()
|
||||
cmd := &cobra.Command{}
|
||||
cmd.Flags().String("username", username, "")
|
||||
cmd.Flags().String("password", "somepass", "")
|
||||
@@ -531,7 +531,7 @@ func (s *MmctlE2ETestSuite) TestCreateUserCmd() {
|
||||
s.Run("Should create a user but w/o system-admin privileges", func() {
|
||||
printer.Clean()
|
||||
email := s.th.GenerateTestEmail()
|
||||
username := model.NewId()
|
||||
username := model.NewUsername()
|
||||
cmd := &cobra.Command{}
|
||||
cmd.Flags().String("username", username, "")
|
||||
cmd.Flags().String("email", email, "")
|
||||
@@ -550,7 +550,7 @@ func (s *MmctlE2ETestSuite) TestCreateUserCmd() {
|
||||
s.RunForSystemAdminAndLocal("Should create new system-admin user given required params", func(c client.Client) {
|
||||
printer.Clean()
|
||||
email := s.th.GenerateTestEmail()
|
||||
username := model.NewId()
|
||||
username := model.NewUsername()
|
||||
cmd := &cobra.Command{}
|
||||
cmd.Flags().String("username", username, "")
|
||||
cmd.Flags().String("email", email, "")
|
||||
@@ -569,7 +569,7 @@ func (s *MmctlE2ETestSuite) TestCreateUserCmd() {
|
||||
s.RunForAllClients("Should create new user given required params", func(c client.Client) {
|
||||
printer.Clean()
|
||||
email := s.th.GenerateTestEmail()
|
||||
username := model.NewId()
|
||||
username := model.NewUsername()
|
||||
cmd := &cobra.Command{}
|
||||
cmd.Flags().String("username", username, "")
|
||||
cmd.Flags().String("email", email, "")
|
||||
@@ -587,7 +587,7 @@ func (s *MmctlE2ETestSuite) TestCreateUserCmd() {
|
||||
s.RunForSystemAdminAndLocal("Should create new user with the email already verified only for admin or local mode", func(c client.Client) {
|
||||
printer.Clean()
|
||||
email := s.th.GenerateTestEmail()
|
||||
username := model.NewId()
|
||||
username := model.NewUsername()
|
||||
cmd := &cobra.Command{}
|
||||
cmd.Flags().String("username", username, "")
|
||||
cmd.Flags().String("email", email, "")
|
||||
@@ -854,7 +854,7 @@ func (s *MmctlE2ETestSuite) TestUserConvertCmdF() {
|
||||
s.RunForSystemAdminAndLocal("Valid user to bot convert", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
user, _ := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, _ := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
|
||||
email := user.Email
|
||||
cmd := &cobra.Command{}
|
||||
@@ -1002,7 +1002,7 @@ func (s *MmctlE2ETestSuite) TestDeleteAllUserCmd() {
|
||||
func (s *MmctlE2ETestSuite) TestPromoteGuestToUserCmd() {
|
||||
s.SetupEnterpriseTestHelper().InitBasic()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
s.th.App.UpdateConfig(func(c *model.Config) { *c.GuestAccountsSettings.Enable = true })
|
||||
@@ -1034,7 +1034,7 @@ func (s *MmctlE2ETestSuite) TestPromoteGuestToUserCmd() {
|
||||
func (s *MmctlE2ETestSuite) TestDemoteUserToGuestCmd() {
|
||||
s.SetupEnterpriseTestHelper().InitBasic()
|
||||
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewId(), Password: model.NewId()})
|
||||
user, appErr := s.th.App.CreateUser(s.th.Context, &model.User{Email: s.th.GenerateTestEmail(), Username: model.NewUsername(), Password: model.NewId()})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
s.th.App.UpdateConfig(func(c *model.Config) { *c.GuestAccountsSettings.Enable = true })
|
||||
|
||||
Ссылка в новой задаче
Block a user