Automatic Merge
Этот коммит содержится в:
Mattermost Build
2026-05-01 00:17:38 +02:00
коммит произвёл GitHub
родитель 6fd49f56b5
Коммит aba9339a24
2 изменённых файлов: 29 добавлений и 11 удалений

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

@@ -152,6 +152,23 @@ func TestEnsureBot(t *testing.T) {
assert.Equal(t, "another bot", bot.Description)
})
t.Run("ensure bot should fail if username belongs to a non-bot user", func(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
pluginId := "pluginId"
// th.BasicUser is a regular (non-bot) user created by InitBasic.
// EnsureBot must return an error — not the human user's ID.
botID, err := th.App.EnsureBot(th.Context, pluginId, &model.Bot{
Username: th.BasicUser.Username,
Description: "a bot",
OwnerId: th.BasicUser.Id,
})
require.Error(t, err)
assert.Empty(t, botID)
})
t.Run("ensure bot should pass even after delete bot user", func(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()