MM-57245: Bump up Go version to 1.21 (#26512)
* MM-57245: Bump up Go version to 1.21 https://mattermost.atlassian.net/browse/MM-57245 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1dc5c006f2
Коммит
5e851f708b
@@ -26,25 +26,25 @@ func (s *MmctlUnitTestSuite) TestGenerateTokenForAUserCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userArg, "").
|
||||
GetUserByEmail(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), userArg, "").
|
||||
GetUserByUsername(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given username")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), userArg, "").
|
||||
GetUser(context.TODO(), userArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateUserAccessToken(context.Background(), mockUser.Id, mockToken.Description).
|
||||
CreateUserAccessToken(context.TODO(), mockUser.Id, mockToken.Description).
|
||||
Return(&mockToken, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -60,19 +60,19 @@ func (s *MmctlUnitTestSuite) TestGenerateTokenForAUserCmd() {
|
||||
userArg := "some-text"
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userArg, "").
|
||||
GetUserByEmail(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), userArg, "").
|
||||
GetUserByUsername(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given username")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), userArg, "").
|
||||
GetUser(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given ID")).
|
||||
Times(1)
|
||||
|
||||
@@ -89,19 +89,19 @@ func (s *MmctlUnitTestSuite) TestGenerateTokenForAUserCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userArg, "").
|
||||
GetUserByEmail(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), userArg, "").
|
||||
GetUserByUsername(context.TODO(), userArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateUserAccessToken(context.Background(), mockUser.Id, "description").
|
||||
CreateUserAccessToken(context.TODO(), mockUser.Id, "description").
|
||||
Return(nil, &model.Response{}, errors.New("error-message")).
|
||||
Times(1)
|
||||
|
||||
@@ -128,25 +128,25 @@ func (s *MmctlUnitTestSuite) TestListTokensOfAUserCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Id, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Id, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), mockUser.Id, "").
|
||||
GetUserByUsername(context.TODO(), mockUser.Id, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given username")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), mockUser.Id, "").
|
||||
GetUser(context.TODO(), mockUser.Id, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserAccessTokensForUser(context.Background(), mockUser.Id, 0, 9999).
|
||||
GetUserAccessTokensForUser(context.TODO(), mockUser.Id, 0, 9999).
|
||||
Return(
|
||||
[]*model.UserAccessToken{&mockToken1, &mockToken2},
|
||||
&model.Response{}, nil,
|
||||
@@ -175,13 +175,13 @@ func (s *MmctlUnitTestSuite) TestListTokensOfAUserCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Email, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Email, "").
|
||||
Return(&mockUser, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserAccessTokensForUser(context.Background(), mockUser.Id, 0, 2).
|
||||
GetUserAccessTokensForUser(context.TODO(), mockUser.Id, 0, 2).
|
||||
Return(
|
||||
[]*model.UserAccessToken{&mockToken1, &mockToken2},
|
||||
&model.Response{}, nil,
|
||||
@@ -206,19 +206,19 @@ func (s *MmctlUnitTestSuite) TestListTokensOfAUserCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userArg, "").
|
||||
GetUserByEmail(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), userArg, "").
|
||||
GetUserByUsername(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given username")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), userArg, "").
|
||||
GetUser(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given user ID")).
|
||||
Times(1)
|
||||
|
||||
@@ -241,13 +241,13 @@ func (s *MmctlUnitTestSuite) TestListTokensOfAUserCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Email, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Email, "").
|
||||
Return(&mockUser, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserAccessTokensForUser(context.Background(), mockUser.Id, 0, 2).
|
||||
GetUserAccessTokensForUser(context.TODO(), mockUser.Id, 0, 2).
|
||||
Return(
|
||||
[]*model.UserAccessToken{},
|
||||
&model.Response{}, nil,
|
||||
@@ -268,13 +268,13 @@ func (s *MmctlUnitTestSuite) TestRevokeTokenForAUserCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RevokeUserAccessToken(context.Background(), mockToken1.Id).
|
||||
RevokeUserAccessToken(context.TODO(), mockToken1.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RevokeUserAccessToken(context.Background(), mockToken2.Id).
|
||||
RevokeUserAccessToken(context.TODO(), mockToken2.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -286,7 +286,7 @@ func (s *MmctlUnitTestSuite) TestRevokeTokenForAUserCmdF() {
|
||||
s.Run("Should fail if can't revoke user access token", func() {
|
||||
s.client.
|
||||
EXPECT().
|
||||
RevokeUserAccessToken(context.Background(), "token-id").
|
||||
RevokeUserAccessToken(context.TODO(), "token-id").
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, errors.New("some-error")).
|
||||
Times(1)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user