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() {
|
||||
|
||||
Ссылка в новой задаче
Block a user