[GH-25494] add request context to public methods in bot go (#26408)

Этот коммит содержится в:
Ezekiel
2024-03-11 20:24:35 +08:00
коммит произвёл GitHub
родитель bca5ab9a1f
Коммит 1c846d8341
18 изменённых файлов: 215 добавлений и 215 удалений

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

@@ -916,7 +916,7 @@ func TestGetBotUser(t *testing.T) {
createdBot, resp, err := th.Client.CreateBot(context.Background(), bot)
require.NoError(t, err)
CheckCreatedStatus(t, resp)
defer th.App.PermanentDeleteBot(createdBot.UserId)
defer th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
botUser, _, err := th.Client.GetUser(context.Background(), createdBot.UserId, "")
require.NoError(t, err)
@@ -4556,7 +4556,7 @@ func TestCreateUserAccessToken(t *testing.T) {
})
require.NoError(t, err)
CheckCreatedStatus(t, resp)
defer th.App.PermanentDeleteBot(createdBot.UserId)
defer th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
t.Run("without MANAGE_BOT permission", func(t *testing.T) {
th.RemovePermissionFromRole(model.PermissionManageBots.Id, model.TeamUserRoleId)
@@ -4598,7 +4598,7 @@ func TestCreateUserAccessToken(t *testing.T) {
})
require.NoError(t, err)
CheckCreatedStatus(t, resp)
defer th.App.PermanentDeleteBot(createdBot.UserId)
defer th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
t.Run("only having MANAGE_BOTS permission", func(t *testing.T) {
_, resp, err = th.Client.CreateUserAccessToken(context.Background(), createdBot.UserId, "test token")
@@ -4703,7 +4703,7 @@ func TestGetUserAccessToken(t *testing.T) {
})
require.NoError(t, err)
CheckCreatedStatus(t, resp)
defer th.App.PermanentDeleteBot(createdBot.UserId)
defer th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
token, _, err := th.Client.CreateUserAccessToken(context.Background(), createdBot.UserId, "test token")
require.NoError(t, err)
@@ -4751,7 +4751,7 @@ func TestGetUserAccessToken(t *testing.T) {
})
require.NoError(t, err)
CheckCreatedStatus(t, resp)
defer th.App.PermanentDeleteBot(createdBot.UserId)
defer th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
token, _, err := th.SystemAdminClient.CreateUserAccessToken(context.Background(), createdBot.UserId, "test token")
require.NoError(t, err)
@@ -4976,7 +4976,7 @@ func TestRevokeUserAccessToken(t *testing.T) {
})
require.NoError(t, err)
CheckCreatedStatus(t, resp)
defer th.App.PermanentDeleteBot(createdBot.UserId)
defer th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
token, _, err := th.Client.CreateUserAccessToken(context.Background(), createdBot.UserId, "test token")
require.NoError(t, err)
@@ -5020,7 +5020,7 @@ func TestRevokeUserAccessToken(t *testing.T) {
})
require.NoError(t, err)
CheckCreatedStatus(t, resp)
defer th.App.PermanentDeleteBot(createdBot.UserId)
defer th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
token, _, err := th.SystemAdminClient.CreateUserAccessToken(context.Background(), createdBot.UserId, "test token")
require.NoError(t, err)
@@ -5095,7 +5095,7 @@ func TestDisableUserAccessToken(t *testing.T) {
})
require.NoError(t, err)
CheckCreatedStatus(t, resp)
defer th.App.PermanentDeleteBot(createdBot.UserId)
defer th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
token, _, err := th.Client.CreateUserAccessToken(context.Background(), createdBot.UserId, "test token")
require.NoError(t, err)
@@ -5139,7 +5139,7 @@ func TestDisableUserAccessToken(t *testing.T) {
})
require.NoError(t, err)
CheckCreatedStatus(t, resp)
defer th.App.PermanentDeleteBot(createdBot.UserId)
defer th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
token, _, err := th.SystemAdminClient.CreateUserAccessToken(context.Background(), createdBot.UserId, "test token")
require.NoError(t, err)
@@ -5222,7 +5222,7 @@ func TestEnableUserAccessToken(t *testing.T) {
})
require.NoError(t, err)
CheckCreatedStatus(t, resp)
defer th.App.PermanentDeleteBot(createdBot.UserId)
defer th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
token, _, err := th.Client.CreateUserAccessToken(context.Background(), createdBot.UserId, "test token")
require.NoError(t, err)
@@ -5269,7 +5269,7 @@ func TestEnableUserAccessToken(t *testing.T) {
})
require.NoError(t, err)
CheckCreatedStatus(t, resp)
defer th.App.PermanentDeleteBot(createdBot.UserId)
defer th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
token, _, err := th.SystemAdminClient.CreateUserAccessToken(context.Background(), createdBot.UserId, "test token")
require.NoError(t, err)