mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
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 ```
This commit is contained in:
parent
1dc5c006f2
commit
5e851f708b
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@ -42,7 +42,7 @@ jobs:
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '1.20'
|
||||
go-version: '1.21'
|
||||
if: ${{ matrix.language == 'go' }}
|
||||
|
||||
|
||||
|
2
.github/workflows/migration.yml
vendored
2
.github/workflows/migration.yml
vendored
@ -7,7 +7,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
COMPOSE_PROJECT_NAME: ghactions
|
||||
BUILD_IMAGE: mattermost/mattermost-build-server:20230904_golang-1.20.7
|
||||
BUILD_IMAGE: mattermost/mattermost-build-server:1.21.8
|
||||
TEST_IMAGE: migration-test-image
|
||||
defaults:
|
||||
run:
|
||||
|
2
.github/workflows/mmctl-test-template.yml
vendored
2
.github/workflows/mmctl-test-template.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
COMPOSE_PROJECT_NAME: ghactions
|
||||
BUILD_IMAGE: mattermost/mattermost-build-server:20230904_golang-1.20.7
|
||||
BUILD_IMAGE: mattermost/mattermost-build-server:1.21.8
|
||||
steps:
|
||||
- name: Checkout mattermost project
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
@ -1 +1 @@
|
||||
1.20.7
|
||||
1.21.8
|
||||
|
@ -1,3 +1,3 @@
|
||||
FROM golang:1.20.7-bullseye@sha256:c95c52c458a2678251e0769ea13c710b0c52814771c53a495f53b9e87f9c0e99
|
||||
FROM golang:1.21.8-bullseye@sha256:81d98548f08e22a59c5c0be814acc0997f3dfd3313487adcf4e1d3d962af3a43
|
||||
|
||||
RUN apt-get update && apt-get install -y make git apt-transport-https ca-certificates curl software-properties-common build-essential zip xmlsec1 jq
|
||||
|
@ -28,7 +28,7 @@ func (s *MmctlUnitTestSuite) TestBotCreateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateBot(context.Background(), &mockBot).
|
||||
CreateBot(context.TODO(), &mockBot).
|
||||
Return(&mockBot, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -52,25 +52,25 @@ func (s *MmctlUnitTestSuite) TestBotCreateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateBot(context.Background(), &mockBot).
|
||||
CreateBot(context.TODO(), &mockBot).
|
||||
Return(&mockBot, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(model.UserFromBot(&mockBot), &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateUserAccessToken(context.Background(), mockBot.UserId, "autogenerated").
|
||||
CreateUserAccessToken(context.TODO(), mockBot.UserId, "autogenerated").
|
||||
Return(&mockToken, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -89,7 +89,7 @@ func (s *MmctlUnitTestSuite) TestBotCreateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateBot(context.Background(), &mockBot).
|
||||
CreateBot(context.TODO(), &mockBot).
|
||||
Return(nil, &model.Response{}, errors.New("some-error")).
|
||||
Times(1)
|
||||
|
||||
@ -118,19 +118,19 @@ func (s *MmctlUnitTestSuite) TestBotUpdateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchBot(context.Background(), mockUser.Id, gomock.Any()).
|
||||
PatchBot(context.TODO(), mockUser.Id, gomock.Any()).
|
||||
Return(&mockBot, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -150,19 +150,19 @@ func (s *MmctlUnitTestSuite) TestBotUpdateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), botArg, "").
|
||||
GetUser(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -185,19 +185,19 @@ func (s *MmctlUnitTestSuite) TestBotUpdateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchBot(context.Background(), mockUser.Id, gomock.Any()).
|
||||
PatchBot(context.TODO(), mockUser.Id, gomock.Any()).
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -221,13 +221,13 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetBotsIncludeDeleted(context.Background(), 0, 200, "").
|
||||
GetBotsIncludeDeleted(context.TODO(), 0, 200, "").
|
||||
Return([]*model.Bot{&mockBot}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUsersByIds(context.Background(), []string{mockBot.OwnerId}).
|
||||
GetUsersByIds(context.TODO(), []string{mockBot.OwnerId}).
|
||||
Return([]*model.User{&mockUser}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -247,7 +247,7 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetBotsIncludeDeleted(context.Background(), 0, 200, "").
|
||||
GetBotsIncludeDeleted(context.TODO(), 0, 200, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -269,13 +269,13 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetBotsOrphaned(context.Background(), 0, 200, "").
|
||||
GetBotsOrphaned(context.TODO(), 0, 200, "").
|
||||
Return([]*model.Bot{&mockBot}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUsersByIds(context.Background(), []string{mockBot.OwnerId}).
|
||||
GetUsersByIds(context.TODO(), []string{mockBot.OwnerId}).
|
||||
Return([]*model.User{&mockUser}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -295,7 +295,7 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetBotsOrphaned(context.Background(), 0, 200, "").
|
||||
GetBotsOrphaned(context.TODO(), 0, 200, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -317,13 +317,13 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetBots(context.Background(), 0, 200, "").
|
||||
GetBots(context.TODO(), 0, 200, "").
|
||||
Return([]*model.Bot{&mockBot}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUsersByIds(context.Background(), []string{mockBot.OwnerId}).
|
||||
GetUsersByIds(context.TODO(), []string{mockBot.OwnerId}).
|
||||
Return([]*model.User{&mockUser}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -344,13 +344,13 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetBots(context.Background(), 0, 200, "").
|
||||
GetBots(context.TODO(), 0, 200, "").
|
||||
Return([]*model.Bot{&mockBot}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUsersByIds(context.Background(), []string{mockBot.OwnerId}).
|
||||
GetUsersByIds(context.TODO(), []string{mockBot.OwnerId}).
|
||||
Return([]*model.User{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -370,7 +370,7 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetBots(context.Background(), 0, 200, "").
|
||||
GetBots(context.TODO(), 0, 200, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -391,13 +391,13 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetBots(context.Background(), 0, 200, "").
|
||||
GetBots(context.TODO(), 0, 200, "").
|
||||
Return([]*model.Bot{&mockBot}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUsersByIds(context.Background(), []string{mockBot.OwnerId}).
|
||||
GetUsersByIds(context.TODO(), []string{mockBot.OwnerId}).
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -419,19 +419,19 @@ func (s *MmctlUnitTestSuite) TestBotDisableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DisableBot(context.Background(), mockUser.Id).
|
||||
DisableBot(context.TODO(), mockUser.Id).
|
||||
Return(&mockBot, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -448,19 +448,19 @@ func (s *MmctlUnitTestSuite) TestBotDisableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), botArg, "").
|
||||
GetUser(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -483,19 +483,19 @@ func (s *MmctlUnitTestSuite) TestBotDisableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DisableBot(context.Background(), mockUser.Id).
|
||||
DisableBot(context.TODO(), mockUser.Id).
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -517,19 +517,19 @@ func (s *MmctlUnitTestSuite) TestBotEnableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
EnableBot(context.Background(), mockUser.Id).
|
||||
EnableBot(context.TODO(), mockUser.Id).
|
||||
Return(&mockBot, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -546,19 +546,19 @@ func (s *MmctlUnitTestSuite) TestBotEnableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), botArg, "").
|
||||
GetUser(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -581,19 +581,19 @@ func (s *MmctlUnitTestSuite) TestBotEnableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
EnableBot(context.Background(), mockUser.Id).
|
||||
EnableBot(context.TODO(), mockUser.Id).
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -617,31 +617,31 @@ func (s *MmctlUnitTestSuite) TestBotAssignCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(&mockBotUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userArg, "").
|
||||
GetUserByEmail(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), userArg, "").
|
||||
GetUserByUsername(context.TODO(), userArg, "").
|
||||
Return(&mockNewOwner, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
AssignBot(context.Background(), mockBotUser.Id, mockNewOwner.Id).
|
||||
AssignBot(context.TODO(), mockBotUser.Id, mockNewOwner.Id).
|
||||
Return(&mockBot, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -659,19 +659,19 @@ func (s *MmctlUnitTestSuite) TestBotAssignCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), botArg, "").
|
||||
GetUser(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -691,31 +691,31 @@ func (s *MmctlUnitTestSuite) TestBotAssignCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(&mockBotUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), userArg, "").
|
||||
GetUserByUsername(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), userArg, "").
|
||||
GetUser(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userArg, "").
|
||||
GetUserByEmail(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -736,31 +736,31 @@ func (s *MmctlUnitTestSuite) TestBotAssignCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), botArg, "").
|
||||
GetUserByEmail(context.TODO(), botArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), botArg, "").
|
||||
GetUserByUsername(context.TODO(), botArg, "").
|
||||
Return(&mockBotUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userArg, "").
|
||||
GetUserByEmail(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), userArg, "").
|
||||
GetUserByUsername(context.TODO(), userArg, "").
|
||||
Return(&mockNewOwner, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
AssignBot(context.Background(), mockBotUser.Id, mockNewOwner.Id).
|
||||
AssignBot(context.TODO(), mockBotUser.Id, mockNewOwner.Id).
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -44,24 +44,24 @@ func (s *MmctlUnitTestSuite) TestChannelUsersAddCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelName, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelName, teamID, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userEmail, "").
|
||||
GetUserByEmail(context.TODO(), userEmail, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
AddChannelMember(context.Background(), channelID, userID).
|
||||
AddChannelMember(context.TODO(), channelID, userID).
|
||||
Return(&model.ChannelMember{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
err := channelUsersAddCmdF(s.client, cmd, []string{channelArg, userEmail})
|
||||
@ -75,19 +75,19 @@ func (s *MmctlUnitTestSuite) TestChannelUsersAddCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
// No channel is returned by client.
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelName, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelName, teamID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelName, "").
|
||||
GetChannel(context.TODO(), channelName, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -103,12 +103,12 @@ func (s *MmctlUnitTestSuite) TestChannelUsersAddCmdF() {
|
||||
// No team is returned by client.
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamID, "").
|
||||
GetTeamByName(context.TODO(), teamID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -124,38 +124,38 @@ func (s *MmctlUnitTestSuite) TestChannelUsersAddCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelName, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelName, teamID, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), nilUserArg, "").
|
||||
GetUserByEmail(context.TODO(), nilUserArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), nilUserArg, "").
|
||||
GetUserByUsername(context.TODO(), nilUserArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), nilUserArg, "").
|
||||
GetUser(context.TODO(), nilUserArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userEmail, "").
|
||||
GetUserByEmail(context.TODO(), userEmail, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
AddChannelMember(context.Background(), channelID, userID).
|
||||
AddChannelMember(context.TODO(), channelID, userID).
|
||||
Return(&model.ChannelMember{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
err := channelUsersAddCmdF(s.client, cmd, []string{channelArg, nilUserArg, userEmail})
|
||||
@ -170,24 +170,24 @@ func (s *MmctlUnitTestSuite) TestChannelUsersAddCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelName, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelName, teamID, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userEmail, "").
|
||||
GetUserByEmail(context.TODO(), userEmail, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
AddChannelMember(context.Background(), channelID, userID).
|
||||
AddChannelMember(context.TODO(), channelID, userID).
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
err := channelUsersAddCmdF(s.client, cmd, []string{channelArg, userEmail})
|
||||
@ -225,25 +225,25 @@ func (s *MmctlUnitTestSuite) TestChannelUsersRemoveCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(foundTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelName, foundTeam.Id, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelName, foundTeam.Id, "").
|
||||
Return(foundChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userEmail, "").
|
||||
GetUserByEmail(context.TODO(), userEmail, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveUserFromChannel(context.Background(), foundChannel.Id, mockUser.Id).
|
||||
RemoveUserFromChannel(context.TODO(), foundChannel.Id, mockUser.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -289,37 +289,37 @@ func (s *MmctlUnitTestSuite) TestChannelUsersRemoveCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(foundTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelName, foundTeam.Id, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelName, foundTeam.Id, "").
|
||||
Return(foundChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelMembers(context.Background(), foundChannel.Id, 0, 10000, "").
|
||||
GetChannelMembers(context.TODO(), foundChannel.Id, 0, 10000, "").
|
||||
Return(mockChannelMembers, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveUserFromChannel(context.Background(), foundChannel.Id, mockUser.Id).
|
||||
RemoveUserFromChannel(context.TODO(), foundChannel.Id, mockUser.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveUserFromChannel(context.Background(), foundChannel.Id, mockUser2.Id).
|
||||
RemoveUserFromChannel(context.TODO(), foundChannel.Id, mockUser2.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveUserFromChannel(context.Background(), foundChannel.Id, mockUser3.Id).
|
||||
RemoveUserFromChannel(context.TODO(), foundChannel.Id, mockUser3.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -349,37 +349,37 @@ func (s *MmctlUnitTestSuite) TestChannelUsersRemoveCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(foundTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelName, foundTeam.Id, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelName, foundTeam.Id, "").
|
||||
Return(foundChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), userEmail, "").
|
||||
GetUserByEmail(context.TODO(), userEmail, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser2.Email, "").
|
||||
GetUserByEmail(context.TODO(), mockUser2.Email, "").
|
||||
Return(&mockUser2, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveUserFromChannel(context.Background(), foundChannel.Id, mockUser.Id).
|
||||
RemoveUserFromChannel(context.TODO(), foundChannel.Id, mockUser.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveUserFromChannel(context.Background(), foundChannel.Id, mockUser2.Id).
|
||||
RemoveUserFromChannel(context.TODO(), foundChannel.Id, mockUser2.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -412,25 +412,25 @@ func (s *MmctlUnitTestSuite) TestChannelUsersRemoveCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(foundTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelName, foundTeam.Id, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelName, foundTeam.Id, "").
|
||||
Return(foundChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelMembers(context.Background(), foundChannel.Id, 0, 10000, "").
|
||||
GetChannelMembers(context.TODO(), foundChannel.Id, 0, 10000, "").
|
||||
Return(mockChannelMembers, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveUserFromChannel(context.Background(), foundChannel.Id, mockUser.Id).
|
||||
RemoveUserFromChannel(context.TODO(), foundChannel.Id, mockUser.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusNotFound}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
|
@ -19,7 +19,7 @@ func (s *MmctlUnitTestSuite) TestGetChannelArgs() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), notFoundChannel, "").
|
||||
GetChannel(context.TODO(), notFoundChannel, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, notFoundErr).
|
||||
Times(1)
|
||||
|
||||
@ -34,7 +34,7 @@ func (s *MmctlUnitTestSuite) TestGetChannelArgs() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), badRequestChannel, "").
|
||||
GetChannel(context.TODO(), badRequestChannel, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusBadRequest}, badRequestErr).
|
||||
Times(1)
|
||||
|
||||
@ -49,7 +49,7 @@ func (s *MmctlUnitTestSuite) TestGetChannelArgs() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), forbidden, "").
|
||||
GetChannel(context.TODO(), forbidden, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusForbidden}, forbiddenErr).
|
||||
Times(1)
|
||||
|
||||
@ -64,7 +64,7 @@ func (s *MmctlUnitTestSuite) TestGetChannelArgs() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), errChannel, "").
|
||||
GetChannel(context.TODO(), errChannel, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusInternalServerError}, internalServerErrorErr).
|
||||
Times(1)
|
||||
|
||||
@ -79,7 +79,7 @@ func (s *MmctlUnitTestSuite) TestGetChannelArgs() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), successID, "").
|
||||
GetChannel(context.TODO(), successID, "").
|
||||
Return(successChannel, nil, nil).
|
||||
Times(1)
|
||||
|
||||
@ -97,12 +97,12 @@ func (s *MmctlUnitTestSuite) TestGetChannelArgs() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(successTeam, nil, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelID, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelID, teamID, "").
|
||||
Return(successChannel, nil, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -69,17 +69,17 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
// createCommandCmdF will call getTeamFromTeamArg, getUserFromUserArg which then calls GetUserByEmail
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), creatorIDArg, "").
|
||||
GetUserByEmail(context.TODO(), creatorIDArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateCommand(context.Background(), &mockCommand).
|
||||
CreateCommand(context.TODO(), &mockCommand).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -117,17 +117,17 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), creatorIDArg, "").
|
||||
GetUserByEmail(context.TODO(), creatorIDArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateCommand(context.Background(), &mockCommand).
|
||||
CreateCommand(context.TODO(), &mockCommand).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -146,12 +146,12 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamArg, "").
|
||||
GetTeamByName(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -197,12 +197,12 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), creatorIDArg, "").
|
||||
GetUserByEmail(context.TODO(), creatorIDArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -248,12 +248,12 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), creatorIDArg, "").
|
||||
GetUserByEmail(context.TODO(), creatorIDArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -313,18 +313,18 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), creatorIDArg, "").
|
||||
GetUserByEmail(context.TODO(), creatorIDArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
mockError := errors.New("mock error, simulated error for CreateCommand")
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateCommand(context.Background(), &mockCommand).
|
||||
CreateCommand(context.TODO(), &mockCommand).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -344,7 +344,7 @@ func (s *MmctlUnitTestSuite) TestArchiveCommandCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DeleteCommand(context.Background(), arg).
|
||||
DeleteCommand(context.TODO(), arg).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -362,7 +362,7 @@ func (s *MmctlUnitTestSuite) TestArchiveCommandCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DeleteCommand(context.Background(), arg).
|
||||
DeleteCommand(context.TODO(), arg).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -380,7 +380,7 @@ func (s *MmctlUnitTestSuite) TestArchiveCommandCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DeleteCommand(context.Background(), arg).
|
||||
DeleteCommand(context.TODO(), arg).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -417,9 +417,9 @@ func (s *MmctlUnitTestSuite) TestCommandListCmdF() {
|
||||
}
|
||||
|
||||
cmd := &cobra.Command{}
|
||||
s.client.EXPECT().GetAllTeams(context.Background(), "", 0, 10000).Return(teams, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().ListCommands(context.Background(), team1ID, true).Return(team1Commands, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().ListCommands(context.Background(), team2Id, true).Return(team2Commands, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().GetAllTeams(context.TODO(), "", 0, 10000).Return(teams, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().ListCommands(context.TODO(), team1ID, true).Return(team1Commands, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().ListCommands(context.TODO(), team2Id, true).Return(team2Commands, &model.Response{}, nil).Times(1)
|
||||
err := listCommandCmdF(s.client, cmd, []string{})
|
||||
s.Require().Nil(err)
|
||||
s.Len(printer.GetLines(), 2)
|
||||
@ -440,8 +440,8 @@ func (s *MmctlUnitTestSuite) TestCommandListCmdF() {
|
||||
}
|
||||
|
||||
cmd := &cobra.Command{}
|
||||
s.client.EXPECT().GetTeam(context.Background(), teamID, "").Return(team, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().ListCommands(context.Background(), teamID, true).Return(teamCommand, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().GetTeam(context.TODO(), teamID, "").Return(team, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().ListCommands(context.TODO(), teamID, true).Return(teamCommand, &model.Response{}, nil).Times(1)
|
||||
err := listCommandCmdF(s.client, cmd, []string{teamID})
|
||||
s.Require().Nil(err)
|
||||
s.Len(printer.GetLines(), 1)
|
||||
@ -454,9 +454,9 @@ func (s *MmctlUnitTestSuite) TestCommandListCmdF() {
|
||||
printer.Clean()
|
||||
cmd := &cobra.Command{}
|
||||
// first try to get team by id
|
||||
s.client.EXPECT().GetTeam(context.Background(), teamID, "").Return(nil, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().GetTeam(context.TODO(), teamID, "").Return(nil, &model.Response{}, nil).Times(1)
|
||||
// second try to search the team by name
|
||||
s.client.EXPECT().GetTeamByName(context.Background(), teamID, "").Return(nil, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().GetTeamByName(context.TODO(), teamID, "").Return(nil, &model.Response{}, nil).Times(1)
|
||||
err := listCommandCmdF(s.client, cmd, []string{teamID})
|
||||
s.Require().Error(err)
|
||||
s.Len(printer.GetLines(), 0)
|
||||
@ -469,8 +469,8 @@ func (s *MmctlUnitTestSuite) TestCommandListCmdF() {
|
||||
printer.Clean()
|
||||
cmd := &cobra.Command{}
|
||||
team := &model.Team{Id: teamID}
|
||||
s.client.EXPECT().GetTeam(context.Background(), teamID, "").Return(team, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().ListCommands(context.Background(), teamID, true).Return(nil, &model.Response{}, errors.New("")).Times(1)
|
||||
s.client.EXPECT().GetTeam(context.TODO(), teamID, "").Return(team, &model.Response{}, nil).Times(1)
|
||||
s.client.EXPECT().ListCommands(context.TODO(), teamID, true).Return(nil, &model.Response{}, errors.New("")).Times(1)
|
||||
err := listCommandCmdF(s.client, cmd, []string{teamID})
|
||||
s.Require().Error(err)
|
||||
s.Len(printer.GetLines(), 0)
|
||||
@ -542,17 +542,17 @@ func (s *MmctlUnitTestSuite) TestCommandModifyCmd() {
|
||||
// modifyCommandCmdF will call getCommandById, GetUserByEmail and UpdateCommand
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), arg).
|
||||
GetCommandById(context.TODO(), arg).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockCommandModified.CreatorId, "").
|
||||
GetUserByEmail(context.TODO(), mockCommandModified.CreatorId, "").
|
||||
Return(&model.User{Id: mockCommandModified.CreatorId}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateCommand(context.Background(), &mockCommand).
|
||||
UpdateCommand(context.TODO(), &mockCommand).
|
||||
Return(mockCommandModified, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -583,7 +583,7 @@ func (s *MmctlUnitTestSuite) TestCommandModifyCmd() {
|
||||
// modifyCommandCmdF will call getCommandById
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), arg).
|
||||
GetCommandById(context.TODO(), arg).
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -616,22 +616,22 @@ func (s *MmctlUnitTestSuite) TestCommandModifyCmd() {
|
||||
// via email, username, and id.
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), arg).
|
||||
GetCommandById(context.TODO(), arg).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), bogusUsername, "").
|
||||
GetUserByEmail(context.TODO(), bogusUsername, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), bogusUsername, "").
|
||||
GetUserByUsername(context.TODO(), bogusUsername, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), bogusUsername, "").
|
||||
GetUser(context.TODO(), bogusUsername, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -662,7 +662,7 @@ func (s *MmctlUnitTestSuite) TestCommandModifyCmd() {
|
||||
// modifyCommandCmdF will call getCommandById
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), arg).
|
||||
GetCommandById(context.TODO(), arg).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -693,7 +693,7 @@ func (s *MmctlUnitTestSuite) TestCommandModifyCmd() {
|
||||
// modifyCommandCmdF will call getCommandById
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), arg).
|
||||
GetCommandById(context.TODO(), arg).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -724,13 +724,13 @@ func (s *MmctlUnitTestSuite) TestCommandModifyCmd() {
|
||||
// modifyCommandCmdF will call getCommandById then UpdateCommand
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), arg).
|
||||
GetCommandById(context.TODO(), arg).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
mockError := errors.New("mock error, simulated error for CreateCommand")
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateCommand(context.Background(), &mockCommand).
|
||||
UpdateCommand(context.TODO(), &mockCommand).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -793,22 +793,22 @@ func (s *MmctlUnitTestSuite) TestCommandMoveCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamArg, "").
|
||||
GetTeamByName(context.TODO(), teamArg, "").
|
||||
Return(&mockTeamDest, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), commandArg).
|
||||
GetCommandById(context.TODO(), commandArg).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
MoveCommand(context.Background(), teamArg, mockCommand.Id).
|
||||
MoveCommand(context.TODO(), teamArg, mockCommand.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -823,12 +823,12 @@ func (s *MmctlUnitTestSuite) TestCommandMoveCmd() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArgBogus, "").
|
||||
GetTeam(context.TODO(), teamArgBogus, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamArgBogus, "").
|
||||
GetTeamByName(context.TODO(), teamArgBogus, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -843,12 +843,12 @@ func (s *MmctlUnitTestSuite) TestCommandMoveCmd() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeamDest, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), commandArgBogus).
|
||||
GetCommandById(context.TODO(), commandArgBogus).
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -863,17 +863,17 @@ func (s *MmctlUnitTestSuite) TestCommandMoveCmd() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeamDest, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), commandArg).
|
||||
GetCommandById(context.TODO(), commandArg).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
MoveCommand(context.Background(), teamArg, commandArg).
|
||||
MoveCommand(context.TODO(), teamArg, commandArg).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -888,17 +888,17 @@ func (s *MmctlUnitTestSuite) TestCommandMoveCmd() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeamDest, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), commandArg).
|
||||
GetCommandById(context.TODO(), commandArg).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
MoveCommand(context.Background(), teamArg, commandArg).
|
||||
MoveCommand(context.TODO(), teamArg, commandArg).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -937,7 +937,7 @@ func (s *MmctlUnitTestSuite) TestCommandShowCmd() {
|
||||
// showCommandCmdF will look up command by id
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), commandArg).
|
||||
GetCommandById(context.TODO(), commandArg).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -953,7 +953,7 @@ func (s *MmctlUnitTestSuite) TestCommandShowCmd() {
|
||||
// showCommandCmdF will look up command by id
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), commandArgBogus).
|
||||
GetCommandById(context.TODO(), commandArgBogus).
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -973,13 +973,13 @@ func (s *MmctlUnitTestSuite) TestCommandShowCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), mockTeam.Name, "").
|
||||
GetTeamByName(context.TODO(), mockTeam.Name, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ListCommands(context.Background(), mockTeam.Id, false).
|
||||
ListCommands(context.TODO(), mockTeam.Id, false).
|
||||
Return(list, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -1002,13 +1002,13 @@ func (s *MmctlUnitTestSuite) TestCommandShowCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamName, "").
|
||||
GetTeamByName(context.TODO(), teamName, "").
|
||||
Return(nil, &model.Response{}, errors.New("team not found")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), teamTrigger).
|
||||
GetCommandById(context.TODO(), teamTrigger).
|
||||
Return(nil, &model.Response{}, errors.New("command not found")).
|
||||
Times(1)
|
||||
|
||||
@ -1030,19 +1030,19 @@ func (s *MmctlUnitTestSuite) TestCommandShowCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), mockTeam.Name, "").
|
||||
GetTeamByName(context.TODO(), mockTeam.Name, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ListCommands(context.Background(), mockTeam.Id, false).
|
||||
ListCommands(context.TODO(), mockTeam.Id, false).
|
||||
Return(list, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.Background(), teamTrigger).
|
||||
GetCommandById(context.TODO(), teamTrigger).
|
||||
Return(nil, &model.Response{}, errors.New("bogus")).
|
||||
Times(1)
|
||||
|
||||
|
@ -32,7 +32,7 @@ func (s *MmctlUnitTestSuite) TestConfigGetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(outputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -51,7 +51,7 @@ func (s *MmctlUnitTestSuite) TestConfigGetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(outputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -70,7 +70,7 @@ func (s *MmctlUnitTestSuite) TestConfigGetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(outputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -89,7 +89,7 @@ func (s *MmctlUnitTestSuite) TestConfigGetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(outputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -108,7 +108,7 @@ func (s *MmctlUnitTestSuite) TestConfigGetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(outputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -129,7 +129,7 @@ func (s *MmctlUnitTestSuite) TestConfigGetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(outputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -150,7 +150,7 @@ func (s *MmctlUnitTestSuite) TestConfigGetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(outputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -170,7 +170,7 @@ func (s *MmctlUnitTestSuite) TestConfigGetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(outputConfig, &model.Response{StatusCode: 500}, errors.New("")).
|
||||
Times(1)
|
||||
|
||||
@ -197,7 +197,7 @@ func (s *MmctlUnitTestSuite) TestConfigGetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(outputConfig, &model.Response{}, nil).
|
||||
Times(7)
|
||||
|
||||
@ -255,7 +255,7 @@ func (s *MmctlUnitTestSuite) TestConfigGetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(outputConfig, &model.Response{}, nil).
|
||||
Times(0)
|
||||
|
||||
@ -272,7 +272,7 @@ func (s *MmctlUnitTestSuite) TestConfigGetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(outputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -296,12 +296,12 @@ func (s *MmctlUnitTestSuite) TestConfigSetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchConfig(context.Background(), inputConfig).
|
||||
PatchConfig(context.TODO(), inputConfig).
|
||||
Return(inputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -324,12 +324,12 @@ func (s *MmctlUnitTestSuite) TestConfigSetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchConfig(context.Background(), inputConfig).
|
||||
PatchConfig(context.TODO(), inputConfig).
|
||||
Return(inputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -352,12 +352,12 @@ func (s *MmctlUnitTestSuite) TestConfigSetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchConfig(context.Background(), inputConfig).
|
||||
PatchConfig(context.TODO(), inputConfig).
|
||||
Return(inputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -380,12 +380,12 @@ func (s *MmctlUnitTestSuite) TestConfigSetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchConfig(context.Background(), inputConfig).
|
||||
PatchConfig(context.TODO(), inputConfig).
|
||||
Return(inputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -407,12 +407,12 @@ func (s *MmctlUnitTestSuite) TestConfigSetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchConfig(context.Background(), inputConfig).
|
||||
PatchConfig(context.TODO(), inputConfig).
|
||||
Return(inputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -434,7 +434,7 @@ func (s *MmctlUnitTestSuite) TestConfigSetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -453,7 +453,7 @@ func (s *MmctlUnitTestSuite) TestConfigSetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -475,12 +475,12 @@ func (s *MmctlUnitTestSuite) TestConfigSetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchConfig(context.Background(), inputConfig).
|
||||
PatchConfig(context.TODO(), inputConfig).
|
||||
Return(inputConfig, &model.Response{StatusCode: 500}, errors.New("")).
|
||||
Times(1)
|
||||
|
||||
@ -515,13 +515,13 @@ func (s *MmctlUnitTestSuite) TestConfigSetCmd() {
|
||||
}
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(3)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchConfig(context.Background(), inputConfig).
|
||||
PatchConfig(context.TODO(), inputConfig).
|
||||
Return(inputConfig, &model.Response{}, nil).
|
||||
Times(3)
|
||||
|
||||
@ -555,7 +555,7 @@ func (s *MmctlUnitTestSuite) TestConfigSetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -576,7 +576,7 @@ func (s *MmctlUnitTestSuite) TestConfigSetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -617,12 +617,12 @@ func (s *MmctlUnitTestSuite) TestConfigPatchCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchConfig(context.Background(), inputConfig).
|
||||
PatchConfig(context.TODO(), inputConfig).
|
||||
Return(inputConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -640,7 +640,7 @@ func (s *MmctlUnitTestSuite) TestConfigPatchCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -668,12 +668,12 @@ func (s *MmctlUnitTestSuite) TestConfigResetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateConfig(context.Background(), defaultConfig).
|
||||
UpdateConfig(context.TODO(), defaultConfig).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -694,12 +694,12 @@ func (s *MmctlUnitTestSuite) TestConfigResetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateConfig(context.Background(), defaultConfig).
|
||||
UpdateConfig(context.TODO(), defaultConfig).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -721,7 +721,7 @@ func (s *MmctlUnitTestSuite) TestConfigResetCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(defaultConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -742,7 +742,7 @@ func (s *MmctlUnitTestSuite) TestConfigShowCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(mockConfig, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -759,7 +759,7 @@ func (s *MmctlUnitTestSuite) TestConfigShowCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetConfig(context.Background()).
|
||||
GetConfig(context.TODO()).
|
||||
Return(nil, &model.Response{}, configError).
|
||||
Times(1)
|
||||
|
||||
@ -775,7 +775,7 @@ func (s *MmctlUnitTestSuite) TestConfigReloadCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ReloadConfig(context.Background()).
|
||||
ReloadConfig(context.TODO()).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -789,7 +789,7 @@ func (s *MmctlUnitTestSuite) TestConfigReloadCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ReloadConfig(context.Background()).
|
||||
ReloadConfig(context.TODO()).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, errors.New("some-error")).
|
||||
Times(1)
|
||||
|
||||
@ -813,7 +813,7 @@ func (s *MmctlUnitTestSuite) TestConfigMigrateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
MigrateConfig(context.Background(), args[0], args[1]).
|
||||
MigrateConfig(context.TODO(), args[0], args[1]).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -831,7 +831,7 @@ func (s *MmctlUnitTestSuite) TestConfigMigrateCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
MigrateConfig(context.Background(), args[0], args[1]).
|
||||
MigrateConfig(context.TODO(), args[0], args[1]).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, errors.New("some-error")).
|
||||
Times(1)
|
||||
|
||||
|
@ -24,7 +24,7 @@ func (s *MmctlUnitTestSuite) TestExportCreateCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateJob(context.Background(), mockJob).
|
||||
CreateJob(context.TODO(), mockJob).
|
||||
Return(mockJob, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -44,7 +44,7 @@ func (s *MmctlUnitTestSuite) TestExportCreateCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateJob(context.Background(), mockJob).
|
||||
CreateJob(context.TODO(), mockJob).
|
||||
Return(mockJob, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -66,7 +66,7 @@ func (s *MmctlUnitTestSuite) TestExportDeleteCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DeleteExport(context.Background(), exportName).
|
||||
DeleteExport(context.TODO(), exportName).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -84,7 +84,7 @@ func (s *MmctlUnitTestSuite) TestExportListCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ListExports(context.Background()).
|
||||
ListExports(context.TODO()).
|
||||
Return(mockExports, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -105,7 +105,7 @@ func (s *MmctlUnitTestSuite) TestExportListCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ListExports(context.Background()).
|
||||
ListExports(context.TODO()).
|
||||
Return(mockExports, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -23,7 +23,7 @@ func (s *MmctlUnitTestSuite) TestListLdapGroupsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetLdapGroups(context.Background()).
|
||||
GetLdapGroups(context.TODO()).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -43,7 +43,7 @@ func (s *MmctlUnitTestSuite) TestListLdapGroupsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetLdapGroups(context.Background()).
|
||||
GetLdapGroups(context.TODO()).
|
||||
Return(mockList, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -65,13 +65,13 @@ func (s *MmctlUnitTestSuite) TestTeamGroupEnableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), arg, "").
|
||||
GetTeam(context.TODO(), arg, "").
|
||||
Return(nil, &model.Response{}, errors.New("")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), arg, "").
|
||||
GetTeamByName(context.TODO(), arg, "").
|
||||
Return(nil, &model.Response{}, errors.New("")).
|
||||
Times(1)
|
||||
|
||||
@ -96,13 +96,13 @@ func (s *MmctlUnitTestSuite) TestTeamGroupEnableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), arg, "").
|
||||
GetTeam(context.TODO(), arg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByTeam(context.Background(), mockTeam.Id, groupOpts).
|
||||
GetGroupsByTeam(context.TODO(), mockTeam.Id, groupOpts).
|
||||
Return(nil, 0, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -126,13 +126,13 @@ func (s *MmctlUnitTestSuite) TestTeamGroupEnableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), arg, "").
|
||||
GetTeam(context.TODO(), arg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByTeam(context.Background(), mockTeam.Id, groupOpts).
|
||||
GetGroupsByTeam(context.TODO(), mockTeam.Id, groupOpts).
|
||||
Return([]*model.GroupWithSchemeAdmin{}, 0, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -158,19 +158,19 @@ func (s *MmctlUnitTestSuite) TestTeamGroupEnableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), arg, "").
|
||||
GetTeam(context.TODO(), arg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByTeam(context.Background(), mockTeam.Id, groupOpts).
|
||||
GetGroupsByTeam(context.TODO(), mockTeam.Id, groupOpts).
|
||||
Return([]*model.GroupWithSchemeAdmin{{}}, 1, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchTeam(context.Background(), mockTeam.Id, &teamPatch).
|
||||
PatchTeam(context.TODO(), mockTeam.Id, &teamPatch).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -195,19 +195,19 @@ func (s *MmctlUnitTestSuite) TestTeamGroupEnableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), arg, "").
|
||||
GetTeam(context.TODO(), arg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByTeam(context.Background(), mockTeam.Id, groupOpts).
|
||||
GetGroupsByTeam(context.TODO(), mockTeam.Id, groupOpts).
|
||||
Return([]*model.GroupWithSchemeAdmin{{}}, 1, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchTeam(context.Background(), mockTeam.Id, &teamPatch).
|
||||
PatchTeam(context.TODO(), mockTeam.Id, &teamPatch).
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -227,13 +227,13 @@ func (s *MmctlUnitTestSuite) TestTeamGroupDisableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchTeam(context.Background(), teamArg, &teamPatch).
|
||||
PatchTeam(context.TODO(), teamArg, &teamPatch).
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -248,13 +248,13 @@ func (s *MmctlUnitTestSuite) TestTeamGroupDisableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamArg, "").
|
||||
GetTeamByName(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -274,13 +274,13 @@ func (s *MmctlUnitTestSuite) TestTeamGroupDisableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchTeam(context.Background(), teamArg, &teamPatch).
|
||||
PatchTeam(context.TODO(), teamArg, &teamPatch).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -316,19 +316,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelID, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelID, teamID, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByChannel(context.Background(), channelID, *groupOpts).
|
||||
GetGroupsByChannel(context.TODO(), channelID, *groupOpts).
|
||||
Return(mockGroups, 0, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -363,19 +363,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelID, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelID, teamID, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByChannel(context.Background(), channelID, *groupOpts).
|
||||
GetGroupsByChannel(context.TODO(), channelID, *groupOpts).
|
||||
Return(mockGroups, 0, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -408,19 +408,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelID, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelID, teamID, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByChannel(context.Background(), channelID, *groupOpts).
|
||||
GetGroupsByChannel(context.TODO(), channelID, *groupOpts).
|
||||
Return(mockGroups, 0, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -442,19 +442,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelID, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelID, teamID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelID, "").
|
||||
GetChannel(context.TODO(), channelID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -475,13 +475,13 @@ func (s *MmctlUnitTestSuite) TestChannelGroupListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamID, "").
|
||||
GetTeamByName(context.TODO(), teamID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -513,19 +513,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelID, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelID, teamID, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByChannel(context.Background(), channelID, *groupOpts).
|
||||
GetGroupsByChannel(context.TODO(), channelID, *groupOpts).
|
||||
Return(nil, 0, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -548,19 +548,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelID, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelID, teamID, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelID, "").
|
||||
GetChannel(context.TODO(), channelID, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -582,13 +582,13 @@ func (s *MmctlUnitTestSuite) TestChannelGroupListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamID, "").
|
||||
GetTeamByName(context.TODO(), teamID, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -605,13 +605,13 @@ func (s *MmctlUnitTestSuite) TestTeamGroupListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), "team1", "").
|
||||
GetTeam(context.TODO(), "team1", "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), "team1", "").
|
||||
GetTeamByName(context.TODO(), "team1", "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -646,13 +646,13 @@ func (s *MmctlUnitTestSuite) TestTeamGroupListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), "team1", "").
|
||||
GetTeam(context.TODO(), "team1", "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByTeam(context.Background(), "team1", groupOpts).
|
||||
GetGroupsByTeam(context.TODO(), "team1", groupOpts).
|
||||
Return(groups, 2, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -685,13 +685,13 @@ func (s *MmctlUnitTestSuite) TestTeamGroupListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), "team1", "").
|
||||
GetTeam(context.TODO(), "team1", "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByTeam(context.Background(), "team1", groupOpts).
|
||||
GetGroupsByTeam(context.TODO(), "team1", groupOpts).
|
||||
Return(groups, 2, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -716,13 +716,13 @@ func (s *MmctlUnitTestSuite) TestTeamGroupStatusCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamID, "").
|
||||
GetTeamByName(context.TODO(), teamID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -742,7 +742,7 @@ func (s *MmctlUnitTestSuite) TestTeamGroupStatusCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(team, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -765,7 +765,7 @@ func (s *MmctlUnitTestSuite) TestTeamGroupStatusCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(team, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -788,7 +788,7 @@ func (s *MmctlUnitTestSuite) TestTeamGroupStatusCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(team, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -813,13 +813,13 @@ func (s *MmctlUnitTestSuite) TestChannelGroupStatusCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamID, "").
|
||||
GetTeamByName(context.TODO(), teamID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -841,19 +841,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupStatusCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(team, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelID, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelID, teamID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelID, "").
|
||||
GetChannel(context.TODO(), channelID, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -876,13 +876,13 @@ func (s *MmctlUnitTestSuite) TestChannelGroupStatusCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(team, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelID, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelID, teamID, "").
|
||||
Return(channel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -908,13 +908,13 @@ func (s *MmctlUnitTestSuite) TestChannelGroupStatusCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(team, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelID, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelID, teamID, "").
|
||||
Return(channel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -940,13 +940,13 @@ func (s *MmctlUnitTestSuite) TestChannelGroupStatusCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(team, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelID, teamID, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelID, teamID, "").
|
||||
Return(channel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -979,25 +979,25 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByChannel(context.Background(), channelPart, *groupOpts).
|
||||
GetGroupsByChannel(context.TODO(), channelPart, *groupOpts).
|
||||
Return(mockGroups, 0, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.Background(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(true)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(true)}).
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -1017,13 +1017,13 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamArg, "").
|
||||
GetTeamByName(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -1045,19 +1045,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelPart, "").
|
||||
GetChannel(context.TODO(), channelPart, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -1086,19 +1086,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByChannel(context.Background(), channelPart, *groupOpts).
|
||||
GetGroupsByChannel(context.TODO(), channelPart, *groupOpts).
|
||||
Return(nil, 0, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -1129,25 +1129,25 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByChannel(context.Background(), channelPart, *groupOpts).
|
||||
GetGroupsByChannel(context.TODO(), channelPart, *groupOpts).
|
||||
Return(mockGroups, 0, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.Background(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(true)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(true)}).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -1176,19 +1176,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByChannel(context.Background(), channelPart, *groupOpts).
|
||||
GetGroupsByChannel(context.TODO(), channelPart, *groupOpts).
|
||||
Return(mockGroups, 0, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -1208,13 +1208,13 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamArg, "").
|
||||
GetTeamByName(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -1235,19 +1235,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelPart, "").
|
||||
GetChannel(context.TODO(), channelPart, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -1278,31 +1278,31 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelPart, "").
|
||||
GetChannel(context.TODO(), channelPart, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetGroupsByChannel(context.Background(), channelPart, *groupOpts).
|
||||
GetGroupsByChannel(context.TODO(), channelPart, *groupOpts).
|
||||
Return(mockGroups, 0, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.Background(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(true)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(true)}).
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -1325,19 +1325,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupDisableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.Background(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(false)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(false)}).
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -1356,13 +1356,13 @@ func (s *MmctlUnitTestSuite) TestChannelGroupDisableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamArg, "").
|
||||
GetTeamByName(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -1383,19 +1383,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupDisableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelPart, "").
|
||||
GetChannel(context.TODO(), channelPart, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -1418,25 +1418,25 @@ func (s *MmctlUnitTestSuite) TestChannelGroupDisableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamArg, "").
|
||||
GetTeamByName(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.Background(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(false)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(false)}).
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -1456,13 +1456,13 @@ func (s *MmctlUnitTestSuite) TestChannelGroupDisableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamArg, "").
|
||||
GetTeamByName(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -1484,19 +1484,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupDisableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelPart, "").
|
||||
GetChannel(context.TODO(), channelPart, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -1519,19 +1519,19 @@ func (s *MmctlUnitTestSuite) TestChannelGroupDisableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannelByNameIncludeDeleted(context.Background(), channelPart, teamArg, "").
|
||||
GetChannelByNameIncludeDeleted(context.TODO(), channelPart, teamArg, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.Background(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(false)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(false)}).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -1549,7 +1549,7 @@ func (s *MmctlUnitTestSuite) TestUserGroupRestoreCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RestoreGroup(context.Background(), "groupId", "").
|
||||
RestoreGroup(context.TODO(), "groupId", "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -1566,7 +1566,7 @@ func (s *MmctlUnitTestSuite) TestUserGroupRestoreCmd() {
|
||||
mockError := errors.New("no group found")
|
||||
s.client.
|
||||
EXPECT().
|
||||
RestoreGroup(context.Background(), "groupId", "").
|
||||
RestoreGroup(context.TODO(), "groupId", "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, mockError).
|
||||
Times(1)
|
||||
|
||||
|
@ -22,7 +22,7 @@ func (s *MmctlUnitTestSuite) TestImportListAvailableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ListImports(context.Background()).
|
||||
ListImports(context.TODO()).
|
||||
Return(mockImports, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -43,7 +43,7 @@ func (s *MmctlUnitTestSuite) TestImportListAvailableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ListImports(context.Background()).
|
||||
ListImports(context.TODO()).
|
||||
Return(mockImports, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -64,7 +64,7 @@ func (s *MmctlUnitTestSuite) TestImportListIncompleteCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUploadsForUser(context.Background(), "me").
|
||||
GetUploadsForUser(context.TODO(), "me").
|
||||
Return(mockUploads, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -94,7 +94,7 @@ func (s *MmctlUnitTestSuite) TestImportListIncompleteCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUploadsForUser(context.Background(), "me").
|
||||
GetUploadsForUser(context.TODO(), "me").
|
||||
Return(mockUploads, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -115,7 +115,7 @@ func (s *MmctlUnitTestSuite) TestImportJobShowCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetJob(context.Background(), jobID).
|
||||
GetJob(context.TODO(), jobID).
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, errors.New("not found")).
|
||||
Times(1)
|
||||
|
||||
@ -133,7 +133,7 @@ func (s *MmctlUnitTestSuite) TestImportJobShowCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetJob(context.Background(), mockJob.Id).
|
||||
GetJob(context.TODO(), mockJob.Id).
|
||||
Return(mockJob, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -158,7 +158,7 @@ func (s *MmctlUnitTestSuite) TestImportJobListCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetJobsByType(context.Background(), model.JobTypeImportProcess, 0, perPage).
|
||||
GetJobsByType(context.TODO(), model.JobTypeImportProcess, 0, perPage).
|
||||
Return(mockJobs, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -191,7 +191,7 @@ func (s *MmctlUnitTestSuite) TestImportJobListCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetJobsByType(context.Background(), model.JobTypeImportProcess, 0, perPage).
|
||||
GetJobsByType(context.TODO(), model.JobTypeImportProcess, 0, perPage).
|
||||
Return(mockJobs, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -215,7 +215,7 @@ func (s *MmctlUnitTestSuite) TestImportProcessCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateJob(context.Background(), mockJob).
|
||||
CreateJob(context.TODO(), mockJob).
|
||||
Return(mockJob, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -41,7 +41,7 @@ func (s *MmctlUnitTestSuite) TestIntegrityCmd() {
|
||||
}
|
||||
s.client.
|
||||
EXPECT().
|
||||
CheckIntegrity(context.Background()).
|
||||
CheckIntegrity(context.TODO()).
|
||||
Return(mockResults, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -59,7 +59,7 @@ func (s *MmctlUnitTestSuite) TestIntegrityCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CheckIntegrity(context.Background()).
|
||||
CheckIntegrity(context.TODO()).
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -99,7 +99,7 @@ func (s *MmctlUnitTestSuite) TestIntegrityCmd() {
|
||||
}
|
||||
s.client.
|
||||
EXPECT().
|
||||
CheckIntegrity(context.Background()).
|
||||
CheckIntegrity(context.TODO()).
|
||||
Return(mockResults, &model.Response{}, nil).
|
||||
Times(1)
|
||||
var expected error
|
||||
|
@ -22,7 +22,7 @@ func (s *MmctlUnitTestSuite) TestLdapSyncCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SyncLdap(context.Background(), false).
|
||||
SyncLdap(context.TODO(), false).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -39,7 +39,7 @@ func (s *MmctlUnitTestSuite) TestLdapSyncCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SyncLdap(context.Background(), false).
|
||||
SyncLdap(context.TODO(), false).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -56,7 +56,7 @@ func (s *MmctlUnitTestSuite) TestLdapSyncCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SyncLdap(context.Background(), false).
|
||||
SyncLdap(context.TODO(), false).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -74,7 +74,7 @@ func (s *MmctlUnitTestSuite) TestLdapSyncCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SyncLdap(context.Background(), true).
|
||||
SyncLdap(context.TODO(), true).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -89,7 +89,7 @@ func (s *MmctlUnitTestSuite) TestLdapMigrateID() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
MigrateIdLdap(context.Background(), "test-id").
|
||||
MigrateIdLdap(context.TODO(), "test-id").
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -105,7 +105,7 @@ func (s *MmctlUnitTestSuite) TestLdapMigrateID() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
MigrateIdLdap(context.Background(), "test-id").
|
||||
MigrateIdLdap(context.TODO(), "test-id").
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, errors.New("test-error")).
|
||||
Times(1)
|
||||
|
||||
|
@ -25,7 +25,7 @@ func (s *MmctlUnitTestSuite) TestRemoveLicenseCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveLicenseFile(context.Background()).
|
||||
RemoveLicenseFile(context.TODO()).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -42,7 +42,7 @@ func (s *MmctlUnitTestSuite) TestRemoveLicenseCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveLicenseFile(context.Background()).
|
||||
RemoveLicenseFile(context.TODO()).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockErr).
|
||||
Times(1)
|
||||
|
||||
@ -72,7 +72,7 @@ func (s *MmctlUnitTestSuite) TestUploadLicenseCmdF() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
UploadLicenseFile(context.Background(), mockLicenseFile).
|
||||
UploadLicenseFile(context.TODO(), mockLicenseFile).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -86,7 +86,7 @@ func (s *MmctlUnitTestSuite) TestUploadLicenseCmdF() {
|
||||
errMsg := "open " + path + ": no such file or directory"
|
||||
s.client.
|
||||
EXPECT().
|
||||
UploadLicenseFile(context.Background(), mockLicenseFile).
|
||||
UploadLicenseFile(context.TODO(), mockLicenseFile).
|
||||
Times(0)
|
||||
|
||||
err := uploadLicenseCmdF(s.client, &cobra.Command{}, []string{path})
|
||||
@ -110,7 +110,7 @@ func (s *MmctlUnitTestSuite) TestUploadLicenseStringCmdF() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
UploadLicenseFile(context.Background(), mockLicenseFile).
|
||||
UploadLicenseFile(context.TODO(), mockLicenseFile).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -32,7 +32,7 @@ func (s *MmctlUnitTestSuite) TestLogsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetLogs(context.Background(), 0, 1).
|
||||
GetLogs(context.TODO(), 0, 1).
|
||||
Return(mockSingleLogLine, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -49,7 +49,7 @@ func (s *MmctlUnitTestSuite) TestLogsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetLogs(context.Background(), 0, 0).
|
||||
GetLogs(context.TODO(), 0, 0).
|
||||
Return(mockSingleLogLine, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -68,7 +68,7 @@ func (s *MmctlUnitTestSuite) TestLogsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetLogs(context.Background(), 0, 1).
|
||||
GetLogs(context.TODO(), 0, 1).
|
||||
Return(mockSingleLogLine, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -34,25 +34,25 @@ func (s *MmctlUnitTestSuite) TestAssignUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Username, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), mockUser.Username, "").
|
||||
GetUserByUsername(context.TODO(), mockUser.Username, "").
|
||||
Return(mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateUserRoles(context.Background(), mockUser.Id, fmt.Sprintf("%s %s", mockUser.Roles, mockRole.Name)).
|
||||
UpdateUserRoles(context.TODO(), mockUser.Id, fmt.Sprintf("%s %s", mockUser.Roles, mockRole.Name)).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -86,45 +86,45 @@ func (s *MmctlUnitTestSuite) TestAssignUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
for _, user := range []*model.User{mockUser1, mockUser2} {
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), user.Username, "").
|
||||
GetUserByEmail(context.TODO(), user.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), user.Username, "").
|
||||
GetUserByUsername(context.TODO(), user.Username, "").
|
||||
Return(user, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateUserRoles(context.Background(), user.Id, fmt.Sprintf("%s %s", user.Roles, mockRole.Name)).
|
||||
UpdateUserRoles(context.TODO(), user.Id, fmt.Sprintf("%s %s", user.Roles, mockRole.Name)).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), notFoundUser.Username, "").
|
||||
GetUserByEmail(context.TODO(), notFoundUser.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), notFoundUser.Username, "").
|
||||
GetUserByUsername(context.TODO(), notFoundUser.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), notFoundUser.Username, "").
|
||||
GetUser(context.TODO(), notFoundUser.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -142,7 +142,7 @@ func (s *MmctlUnitTestSuite) TestAssignUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), "non-existent").
|
||||
GetRoleByName(context.TODO(), "non-existent").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, expectedError).
|
||||
Times(1)
|
||||
|
||||
@ -167,19 +167,19 @@ func (s *MmctlUnitTestSuite) TestAssignUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Username, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), mockUser.Username, "").
|
||||
GetUserByUsername(context.TODO(), mockUser.Username, "").
|
||||
Return(mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -199,25 +199,25 @@ func (s *MmctlUnitTestSuite) TestAssignUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), requestedUser, "").
|
||||
GetUserByEmail(context.TODO(), requestedUser, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), requestedUser, "").
|
||||
GetUserByUsername(context.TODO(), requestedUser, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), requestedUser, "").
|
||||
GetUser(context.TODO(), requestedUser, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -243,19 +243,19 @@ func (s *MmctlUnitTestSuite) TestUnassignUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Username, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), mockUser.Username, "").
|
||||
GetUserByUsername(context.TODO(), mockUser.Username, "").
|
||||
Return(mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateUserRoles(context.Background(), mockUser.Id, "system_user team_admin").
|
||||
UpdateUserRoles(context.TODO(), mockUser.Id, "system_user team_admin").
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -286,38 +286,38 @@ func (s *MmctlUnitTestSuite) TestUnassignUsersCmd() {
|
||||
for _, user := range []*model.User{mockUser1, mockUser2} {
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), user.Username, "").
|
||||
GetUserByEmail(context.TODO(), user.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), user.Username, "").
|
||||
GetUserByUsername(context.TODO(), user.Username, "").
|
||||
Return(user, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateUserRoles(context.Background(), user.Id, strings.TrimSpace(strings.ReplaceAll(user.Roles, roleName, ""))).
|
||||
UpdateUserRoles(context.TODO(), user.Id, strings.TrimSpace(strings.ReplaceAll(user.Roles, roleName, ""))).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), notFoundUser.Username, "").
|
||||
GetUserByEmail(context.TODO(), notFoundUser.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), notFoundUser.Username, "").
|
||||
GetUserByUsername(context.TODO(), notFoundUser.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), notFoundUser.Username, "").
|
||||
GetUser(context.TODO(), notFoundUser.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -337,13 +337,13 @@ func (s *MmctlUnitTestSuite) TestUnassignUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Username, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Username, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), mockUser.Username, "").
|
||||
GetUserByUsername(context.TODO(), mockUser.Username, "").
|
||||
Return(mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -357,19 +357,19 @@ func (s *MmctlUnitTestSuite) TestUnassignUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), requestedUser, "").
|
||||
GetUserByEmail(context.TODO(), requestedUser, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), requestedUser, "").
|
||||
GetUserByUsername(context.TODO(), requestedUser, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), requestedUser, "").
|
||||
GetUser(context.TODO(), requestedUser, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -393,7 +393,7 @@ func (s *MmctlUnitTestSuite) TestShowRoleCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -425,7 +425,7 @@ SchemeManaged false
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -455,7 +455,7 @@ Permissions edit_brand
|
||||
// showRoleCmdF will look up role by name
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), commandArgBogus).
|
||||
GetRoleByName(context.TODO(), commandArgBogus).
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, expectedError).
|
||||
Times(1)
|
||||
|
||||
|
@ -39,7 +39,7 @@ func (s *MmctlE2ETestSuite) TestShowRoleCmd() {
|
||||
func (s *MmctlE2ETestSuite) TestAddPermissionsCmd() {
|
||||
s.SetupEnterpriseTestHelper().InitBasic()
|
||||
|
||||
role, appErr := s.th.App.GetRoleByName(context.Background(), model.SystemUserRoleId)
|
||||
role, appErr := s.th.App.GetRoleByName(context.TODO(), model.SystemUserRoleId)
|
||||
s.Require().Nil(appErr)
|
||||
s.Require().NotContains(role.Permissions, model.PermissionCreateBot.Id)
|
||||
|
||||
@ -66,7 +66,7 @@ func (s *MmctlE2ETestSuite) TestAddPermissionsCmd() {
|
||||
|
||||
s.Require().Len(printer.GetLines(), 0)
|
||||
s.Require().Len(printer.GetErrorLines(), 0)
|
||||
updatedRole, appErr := s.th.App.GetRoleByName(context.Background(), model.SystemUserRoleId)
|
||||
updatedRole, appErr := s.th.App.GetRoleByName(context.TODO(), model.SystemUserRoleId)
|
||||
s.Require().Nil(appErr)
|
||||
s.Require().Contains(updatedRole.Permissions, model.PermissionCreateBot.Id)
|
||||
})
|
||||
@ -75,7 +75,7 @@ func (s *MmctlE2ETestSuite) TestAddPermissionsCmd() {
|
||||
func (s *MmctlE2ETestSuite) TestRemovePermissionsCmd() {
|
||||
s.SetupEnterpriseTestHelper().InitBasic()
|
||||
|
||||
role, appErr := s.th.App.GetRoleByName(context.Background(), model.SystemUserRoleId)
|
||||
role, appErr := s.th.App.GetRoleByName(context.TODO(), model.SystemUserRoleId)
|
||||
s.Require().Nil(appErr)
|
||||
s.Require().Contains(role.Permissions, model.PermissionCreateDirectChannel.Id)
|
||||
|
||||
@ -103,7 +103,7 @@ func (s *MmctlE2ETestSuite) TestRemovePermissionsCmd() {
|
||||
s.Require().Len(printer.GetLines(), 0)
|
||||
s.Require().Len(printer.GetErrorLines(), 0)
|
||||
|
||||
updatedRole, appErr := s.th.App.GetRoleByName(context.Background(), model.SystemUserRoleId)
|
||||
updatedRole, appErr := s.th.App.GetRoleByName(context.TODO(), model.SystemUserRoleId)
|
||||
s.Require().Nil(appErr)
|
||||
s.Require().NotContains(updatedRole.Permissions, model.PermissionCreateDirectChannel.Id)
|
||||
})
|
||||
|
@ -32,13 +32,13 @@ func (s *MmctlUnitTestSuite) TestAddPermissionsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchRole(context.Background(), mockRole.Id, expectedPatch).
|
||||
PatchRole(context.TODO(), mockRole.Id, expectedPatch).
|
||||
Return(&model.Role{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -52,7 +52,7 @@ func (s *MmctlUnitTestSuite) TestAddPermissionsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), gomock.Any()).
|
||||
GetRoleByName(context.TODO(), gomock.Any()).
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, expectedError).
|
||||
Times(1)
|
||||
|
||||
@ -71,7 +71,7 @@ func (s *MmctlUnitTestSuite) TestAddPermissionsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -83,7 +83,7 @@ func (s *MmctlUnitTestSuite) TestAddPermissionsCmd() {
|
||||
}
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchRole(context.Background(), mockRole.Id, expectedPatch).
|
||||
PatchRole(context.TODO(), mockRole.Id, expectedPatch).
|
||||
Return(&model.Role{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
args := []string{mockRole.Name, newPermission}
|
||||
@ -107,12 +107,12 @@ func (s *MmctlUnitTestSuite) TestRemovePermissionsCmd() {
|
||||
}
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchRole(context.Background(), mockRole.Id, expectedPatch).
|
||||
PatchRole(context.TODO(), mockRole.Id, expectedPatch).
|
||||
Return(&model.Role{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -133,12 +133,12 @@ func (s *MmctlUnitTestSuite) TestRemovePermissionsCmd() {
|
||||
}
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchRole(context.Background(), mockRole.Id, expectedPatch).
|
||||
PatchRole(context.TODO(), mockRole.Id, expectedPatch).
|
||||
Return(&model.Role{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -159,12 +159,12 @@ func (s *MmctlUnitTestSuite) TestRemovePermissionsCmd() {
|
||||
}
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchRole(context.Background(), mockRole.Id, expectedPatch).
|
||||
PatchRole(context.TODO(), mockRole.Id, expectedPatch).
|
||||
Return(&model.Role{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -181,7 +181,7 @@ func (s *MmctlUnitTestSuite) TestRemovePermissionsCmd() {
|
||||
mockError := errors.New("role_not_found")
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -201,7 +201,7 @@ func (s *MmctlUnitTestSuite) TestResetPermissionsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -219,7 +219,7 @@ func (s *MmctlUnitTestSuite) TestResetPermissionsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(&mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -253,13 +253,13 @@ func (s *MmctlUnitTestSuite) TestResetPermissionsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetRoleByName(context.Background(), mockRole.Name).
|
||||
GetRoleByName(context.TODO(), mockRole.Name).
|
||||
Return(&mockRole, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchRole(context.Background(), mockRole.Id, expectedPatch).
|
||||
PatchRole(context.TODO(), mockRole.Id, expectedPatch).
|
||||
Return(&model.Role{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -33,7 +33,7 @@ func (s *MmctlUnitTestSuite) TestPluginMarketplaceInstallCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
InstallMarketplacePlugin(context.Background(), pluginRequest).
|
||||
InstallMarketplacePlugin(context.TODO(), pluginRequest).
|
||||
Return(manifest, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -53,7 +53,7 @@ func (s *MmctlUnitTestSuite) TestPluginMarketplaceInstallCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
InstallMarketplacePlugin(context.Background(), pluginRequest).
|
||||
InstallMarketplacePlugin(context.TODO(), pluginRequest).
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -77,7 +77,7 @@ func (s *MmctlUnitTestSuite) TestPluginMarketplaceListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetMarketplacePlugins(context.Background(), pluginFilter).
|
||||
GetMarketplacePlugins(context.TODO(), pluginFilter).
|
||||
Return(plugins, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -99,19 +99,19 @@ func (s *MmctlUnitTestSuite) TestPluginMarketplaceListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetMarketplacePlugins(context.Background(), &model.MarketplacePluginFilter{Page: 0, PerPage: 1}).
|
||||
GetMarketplacePlugins(context.TODO(), &model.MarketplacePluginFilter{Page: 0, PerPage: 1}).
|
||||
Return([]*model.MarketplacePlugin{mockPlugin1}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetMarketplacePlugins(context.Background(), &model.MarketplacePluginFilter{Page: 1, PerPage: 1}).
|
||||
GetMarketplacePlugins(context.TODO(), &model.MarketplacePluginFilter{Page: 1, PerPage: 1}).
|
||||
Return([]*model.MarketplacePlugin{mockPlugin2}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetMarketplacePlugins(context.Background(), &model.MarketplacePluginFilter{Page: 2, PerPage: 1}).
|
||||
GetMarketplacePlugins(context.TODO(), &model.MarketplacePluginFilter{Page: 2, PerPage: 1}).
|
||||
Return([]*model.MarketplacePlugin{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -131,7 +131,7 @@ func (s *MmctlUnitTestSuite) TestPluginMarketplaceListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetMarketplacePlugins(context.Background(), &model.MarketplacePluginFilter{Page: 0, PerPage: 200}).
|
||||
GetMarketplacePlugins(context.TODO(), &model.MarketplacePluginFilter{Page: 0, PerPage: 200}).
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -155,7 +155,7 @@ func (s *MmctlUnitTestSuite) TestPluginMarketplaceListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetMarketplacePlugins(context.Background(), pluginFilter).
|
||||
GetMarketplacePlugins(context.TODO(), pluginFilter).
|
||||
Return(plugins, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -29,7 +29,7 @@ func (s *MmctlUnitTestSuite) TestPluginAddCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UploadPlugin(context.Background(), gomock.AssignableToTypeOf(tmpFile)).
|
||||
UploadPlugin(context.TODO(), gomock.AssignableToTypeOf(tmpFile)).
|
||||
Return(&model.Manifest{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -49,7 +49,7 @@ func (s *MmctlUnitTestSuite) TestPluginAddCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UploadPluginForced(context.Background(), gomock.AssignableToTypeOf(tmpFile)).
|
||||
UploadPluginForced(context.TODO(), gomock.AssignableToTypeOf(tmpFile)).
|
||||
Return(&model.Manifest{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -80,7 +80,7 @@ func (s *MmctlUnitTestSuite) TestPluginAddCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UploadPlugin(context.Background(), gomock.AssignableToTypeOf(tmpFile)).
|
||||
UploadPlugin(context.TODO(), gomock.AssignableToTypeOf(tmpFile)).
|
||||
Return(&model.Manifest{}, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -102,13 +102,13 @@ func (s *MmctlUnitTestSuite) TestPluginAddCmd() {
|
||||
if arg == "fail" {
|
||||
s.client.
|
||||
EXPECT().
|
||||
UploadPlugin(context.Background(), gomock.AssignableToTypeOf(tmpFile)).
|
||||
UploadPlugin(context.TODO(), gomock.AssignableToTypeOf(tmpFile)).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
} else {
|
||||
s.client.
|
||||
EXPECT().
|
||||
UploadPlugin(context.Background(), gomock.AssignableToTypeOf(tmpFile)).
|
||||
UploadPlugin(context.TODO(), gomock.AssignableToTypeOf(tmpFile)).
|
||||
Return(&model.Manifest{}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
}
|
||||
@ -137,13 +137,13 @@ func (s *MmctlUnitTestSuite) TestPluginInstallUrlCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
InstallPluginFromURL(context.Background(), pluginURL1, false).
|
||||
InstallPluginFromURL(context.TODO(), pluginURL1, false).
|
||||
Return(manifest1, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
InstallPluginFromURL(context.Background(), pluginURL2, false).
|
||||
InstallPluginFromURL(context.TODO(), pluginURL2, false).
|
||||
Return(manifest2, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -163,7 +163,7 @@ func (s *MmctlUnitTestSuite) TestPluginInstallUrlCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
InstallPluginFromURL(context.Background(), pluginURL, true).
|
||||
InstallPluginFromURL(context.TODO(), pluginURL, true).
|
||||
Return(manifest, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -187,13 +187,13 @@ func (s *MmctlUnitTestSuite) TestPluginInstallUrlCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
InstallPluginFromURL(context.Background(), pluginURL1, false).
|
||||
InstallPluginFromURL(context.TODO(), pluginURL1, false).
|
||||
Return(manifest1, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
InstallPluginFromURL(context.Background(), pluginURL2, false).
|
||||
InstallPluginFromURL(context.TODO(), pluginURL2, false).
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -213,7 +213,7 @@ func (s *MmctlUnitTestSuite) TestPluginDisableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DisablePlugin(context.Background(), arg).
|
||||
DisablePlugin(context.TODO(), arg).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -231,7 +231,7 @@ func (s *MmctlUnitTestSuite) TestPluginDisableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DisablePlugin(context.Background(), arg).
|
||||
DisablePlugin(context.TODO(), arg).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -251,13 +251,13 @@ func (s *MmctlUnitTestSuite) TestPluginDisableCmd() {
|
||||
if strings.HasPrefix(arg, "fail") {
|
||||
s.client.
|
||||
EXPECT().
|
||||
DisablePlugin(context.Background(), arg).
|
||||
DisablePlugin(context.TODO(), arg).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockError).
|
||||
Times(1)
|
||||
} else {
|
||||
s.client.
|
||||
EXPECT().
|
||||
DisablePlugin(context.Background(), arg).
|
||||
DisablePlugin(context.TODO(), arg).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
}
|
||||
@ -281,7 +281,7 @@ func (s *MmctlUnitTestSuite) TestPluginEnableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
EnablePlugin(context.Background(), pluginArg).
|
||||
EnablePlugin(context.TODO(), pluginArg).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -299,7 +299,7 @@ func (s *MmctlUnitTestSuite) TestPluginEnableCmd() {
|
||||
for _, plugin := range plugins {
|
||||
s.client.
|
||||
EXPECT().
|
||||
EnablePlugin(context.Background(), plugin).
|
||||
EnablePlugin(context.TODO(), plugin).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
}
|
||||
@ -320,7 +320,7 @@ func (s *MmctlUnitTestSuite) TestPluginEnableCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
EnablePlugin(context.Background(), pluginArg).
|
||||
EnablePlugin(context.TODO(), pluginArg).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockErr).
|
||||
Times(1)
|
||||
|
||||
@ -343,7 +343,7 @@ func (s *MmctlUnitTestSuite) TestPluginEnableCmd() {
|
||||
for _, plugin := range okPlugins {
|
||||
s.client.
|
||||
EXPECT().
|
||||
EnablePlugin(context.Background(), plugin).
|
||||
EnablePlugin(context.TODO(), plugin).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
}
|
||||
@ -351,7 +351,7 @@ func (s *MmctlUnitTestSuite) TestPluginEnableCmd() {
|
||||
for _, plugin := range failPlugins {
|
||||
s.client.
|
||||
EXPECT().
|
||||
EnablePlugin(context.Background(), plugin).
|
||||
EnablePlugin(context.TODO(), plugin).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockErr).
|
||||
Times(1)
|
||||
}
|
||||
@ -420,7 +420,7 @@ func (s *MmctlUnitTestSuite) TestPluginListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetPlugins(context.Background()).
|
||||
GetPlugins(context.TODO()).
|
||||
Return(mockList, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -496,7 +496,7 @@ func (s *MmctlUnitTestSuite) TestPluginListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetPlugins(context.Background()).
|
||||
GetPlugins(context.TODO()).
|
||||
Return(mockList, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -523,7 +523,7 @@ func (s *MmctlUnitTestSuite) TestPluginListCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetPlugins(context.Background()).
|
||||
GetPlugins(context.TODO()).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -542,7 +542,7 @@ func (s *MmctlUnitTestSuite) TestPluginDeleteCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemovePlugin(context.Background(), args).
|
||||
RemovePlugin(context.TODO(), args).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -559,7 +559,7 @@ func (s *MmctlUnitTestSuite) TestPluginDeleteCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemovePlugin(context.Background(), args).
|
||||
RemovePlugin(context.TODO(), args).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -585,25 +585,25 @@ func (s *MmctlUnitTestSuite) TestPluginDeleteCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemovePlugin(context.Background(), args[0]).
|
||||
RemovePlugin(context.TODO(), args[0]).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemovePlugin(context.Background(), args[1]).
|
||||
RemovePlugin(context.TODO(), args[1]).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockErrors[0]).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemovePlugin(context.Background(), args[2]).
|
||||
RemovePlugin(context.TODO(), args[2]).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockErrors[1]).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemovePlugin(context.Background(), args[3]).
|
||||
RemovePlugin(context.TODO(), args[3]).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -42,7 +42,7 @@ func (s *MmctlUnitTestSuite) TestPostCreateCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetPost(context.Background(), replyToArg, "").
|
||||
GetPost(context.TODO(), replyToArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("some-error")).
|
||||
Times(1)
|
||||
|
||||
@ -63,13 +63,13 @@ func (s *MmctlUnitTestSuite) TestPostCreateCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelArg, "").
|
||||
GetChannel(context.TODO(), channelArg, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DoAPIPost(context.Background(), "/posts?set_online=false", data).
|
||||
DoAPIPost(context.TODO(), "/posts?set_online=false", data).
|
||||
Return(nil, errors.New("some-error")).
|
||||
Times(1)
|
||||
|
||||
@ -90,13 +90,13 @@ func (s *MmctlUnitTestSuite) TestPostCreateCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelArg, "").
|
||||
GetChannel(context.TODO(), channelArg, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DoAPIPost(context.Background(), "/posts?set_online=false", data).
|
||||
DoAPIPost(context.TODO(), "/posts?set_online=false", data).
|
||||
Return(nil, nil).
|
||||
Times(1)
|
||||
|
||||
@ -122,19 +122,19 @@ func (s *MmctlUnitTestSuite) TestPostCreateCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelArg, "").
|
||||
GetChannel(context.TODO(), channelArg, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetPost(context.Background(), replyToArg, "").
|
||||
GetPost(context.TODO(), replyToArg, "").
|
||||
Return(&mockReplyTo, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DoAPIPost(context.Background(), "/posts?set_online=false", data).
|
||||
DoAPIPost(context.TODO(), "/posts?set_online=false", data).
|
||||
Return(nil, nil).
|
||||
Times(1)
|
||||
|
||||
@ -161,7 +161,7 @@ func (s *MmctlUnitTestSuite) TestPostListCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelName, "").
|
||||
GetChannel(context.TODO(), channelName, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -186,19 +186,19 @@ func (s *MmctlUnitTestSuite) TestPostListCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelName, "").
|
||||
GetChannel(context.TODO(), channelName, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetPostsForChannel(context.Background(), channelID, 0, 1, "", false, false).
|
||||
GetPostsForChannel(context.TODO(), channelID, 0, 1, "", false, false).
|
||||
Return(mockPostList, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), userID, "").
|
||||
GetUser(context.TODO(), userID, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -234,19 +234,19 @@ func (s *MmctlUnitTestSuite) TestPostListCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelName, "").
|
||||
GetChannel(context.TODO(), channelName, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetPostsSince(context.Background(), channelID, sinceTimeMillis, false).
|
||||
GetPostsSince(context.TODO(), channelID, sinceTimeMillis, false).
|
||||
Return(mockPostList, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), userID, "").
|
||||
GetUser(context.TODO(), userID, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -25,13 +25,13 @@ func (s *MmctlUnitTestSuite) TestMakeAdminCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Email, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Email, "").
|
||||
Return(mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateUserRoles(context.Background(), mockUser.Id, newRoles).
|
||||
UpdateUserRoles(context.TODO(), mockUser.Id, newRoles).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -51,7 +51,7 @@ func (s *MmctlUnitTestSuite) TestMakeAdminCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Email, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Email, "").
|
||||
Return(mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -69,19 +69,19 @@ func (s *MmctlUnitTestSuite) TestMakeAdminCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), emailArg, "").
|
||||
GetUserByEmail(context.TODO(), emailArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), emailArg, "").
|
||||
GetUserByUsername(context.TODO(), emailArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), emailArg, "").
|
||||
GetUser(context.TODO(), emailArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -101,13 +101,13 @@ func (s *MmctlUnitTestSuite) TestMakeAdminCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Email, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Email, "").
|
||||
Return(mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateUserRoles(context.Background(), mockUser.Id, newRoles).
|
||||
UpdateUserRoles(context.TODO(), mockUser.Id, newRoles).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -128,13 +128,13 @@ func (s *MmctlUnitTestSuite) TestMakeMemberCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Email, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Email, "").
|
||||
Return(mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateUserRoles(context.Background(), mockUser.Id, "system_user").
|
||||
UpdateUserRoles(context.TODO(), mockUser.Id, "system_user").
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -153,7 +153,7 @@ func (s *MmctlUnitTestSuite) TestMakeMemberCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Email, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Email, "").
|
||||
Return(mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -171,13 +171,13 @@ func (s *MmctlUnitTestSuite) TestMakeMemberCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Email, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Email, "").
|
||||
Return(mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateUserRoles(context.Background(), mockUser.Id, "system_user").
|
||||
UpdateUserRoles(context.TODO(), mockUser.Id, "system_user").
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -196,19 +196,19 @@ func (s *MmctlUnitTestSuite) TestMakeMemberCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), emailArg, "").
|
||||
GetUserByEmail(context.TODO(), emailArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), emailArg, "").
|
||||
GetUserByUsername(context.TODO(), emailArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), emailArg, "").
|
||||
GetUser(context.TODO(), emailArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -29,7 +29,7 @@ func (s *MmctlUnitTestSuite) TestSamlAuthDataReset() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ResetSamlAuthDataToEmail(context.Background(), false, false, []string{}).
|
||||
ResetSamlAuthDataToEmail(context.TODO(), false, false, []string{}).
|
||||
Return(int64(1), &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -49,7 +49,7 @@ func (s *MmctlUnitTestSuite) TestSamlAuthDataReset() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ResetSamlAuthDataToEmail(context.Background(), false, true, []string{}).
|
||||
ResetSamlAuthDataToEmail(context.TODO(), false, true, []string{}).
|
||||
Return(int64(1), &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -65,7 +65,7 @@ func (s *MmctlUnitTestSuite) TestSamlAuthDataReset() {
|
||||
users := []string{"user1"}
|
||||
s.client.
|
||||
EXPECT().
|
||||
ResetSamlAuthDataToEmail(context.Background(), false, false, users).
|
||||
ResetSamlAuthDataToEmail(context.TODO(), false, false, users).
|
||||
Return(int64(1), &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -28,7 +28,7 @@ func (s *MmctlUnitTestSuite) TestGetBusyCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetServerBusy(context.Background()).
|
||||
GetServerBusy(context.TODO()).
|
||||
Return(sbs, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -47,7 +47,7 @@ func (s *MmctlUnitTestSuite) TestGetBusyCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetServerBusy(context.Background()).
|
||||
GetServerBusy(context.TODO()).
|
||||
Return(sbs, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -62,7 +62,7 @@ func (s *MmctlUnitTestSuite) TestGetBusyCmd() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetServerBusy(context.Background()).
|
||||
GetServerBusy(context.TODO()).
|
||||
Return(nil, &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -83,7 +83,7 @@ func (s *MmctlUnitTestSuite) TestSetBusyCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SetServerBusy(context.Background(), minutes*60).
|
||||
SetServerBusy(context.TODO(), minutes*60).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -121,7 +121,7 @@ func (s *MmctlUnitTestSuite) TestClearBusyCmd() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
ClearServerBusy(context.Background()).
|
||||
ClearServerBusy(context.TODO()).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -136,7 +136,7 @@ func (s *MmctlUnitTestSuite) TestClearBusyCmd() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
ClearServerBusy(context.Background()).
|
||||
ClearServerBusy(context.TODO()).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -154,7 +154,7 @@ func (s *MmctlUnitTestSuite) TestServerVersionCmd() {
|
||||
expectedVersion := "1.23.4.dev"
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetPing(context.Background()).
|
||||
GetPing(context.TODO()).
|
||||
Return("", &model.Response{ServerVersion: expectedVersion}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -170,7 +170,7 @@ func (s *MmctlUnitTestSuite) TestServerVersionCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetPing(context.Background()).
|
||||
GetPing(context.TODO()).
|
||||
Return("", &model.Response{}, errors.New("mock error")).
|
||||
Times(1)
|
||||
|
||||
@ -188,7 +188,7 @@ func (s *MmctlUnitTestSuite) TestServerStatusCmd() {
|
||||
expectedStatus := map[string]string{"status": "OK"}
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetPingWithOptions(context.Background(), model.SystemPingOptions{
|
||||
GetPingWithOptions(context.TODO(), model.SystemPingOptions{
|
||||
FullStatus: true,
|
||||
RESTSemantics: true,
|
||||
}).
|
||||
@ -207,7 +207,7 @@ func (s *MmctlUnitTestSuite) TestServerStatusCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetPingWithOptions(context.Background(), model.SystemPingOptions{
|
||||
GetPingWithOptions(context.TODO(), model.SystemPingOptions{
|
||||
FullStatus: true,
|
||||
RESTSemantics: true,
|
||||
}).
|
||||
|
@ -56,7 +56,7 @@ func (s *MmctlUnitTestSuite) TestCreateTeamCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateTeam(context.Background(), mockTeam).
|
||||
CreateTeam(context.TODO(), mockTeam).
|
||||
Return(mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -84,7 +84,7 @@ func (s *MmctlUnitTestSuite) TestCreateTeamCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateTeam(context.Background(), mockTeam).
|
||||
CreateTeam(context.TODO(), mockTeam).
|
||||
Return(mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -110,7 +110,7 @@ func (s *MmctlUnitTestSuite) TestCreateTeamCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateTeam(context.Background(), mockTeam).
|
||||
CreateTeam(context.TODO(), mockTeam).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -132,14 +132,14 @@ func (s *MmctlUnitTestSuite) TestRenameTeamCmdF() {
|
||||
// Mocking : GetTeam searches with team id, if team not found proceeds with team name search
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), "existingName", "").
|
||||
GetTeam(context.TODO(), "existingName", "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
// Mocking : GetTeamByname is called, if GetTeam fails to return any team, as team name was passed instead of team id
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), "existingName", "").
|
||||
GetTeamByName(context.TODO(), "existingName", "").
|
||||
Return(nil, &model.Response{}, nil). // Error is nil as team not found will not return error from API
|
||||
Times(1)
|
||||
|
||||
@ -170,13 +170,13 @@ func (s *MmctlUnitTestSuite) TestRenameTeamCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), args[0], "").
|
||||
GetTeam(context.TODO(), args[0], "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), args[0], "").
|
||||
GetTeamByName(context.TODO(), args[0], "").
|
||||
Return(foundTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -186,7 +186,7 @@ func (s *MmctlUnitTestSuite) TestRenameTeamCmdF() {
|
||||
// Mock out UpdateTeam which calls the api to rename team
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateTeam(context.Background(), renamedTeam).
|
||||
UpdateTeam(context.TODO(), renamedTeam).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -216,19 +216,19 @@ func (s *MmctlUnitTestSuite) TestRenameTeamCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), args[0], "").
|
||||
GetTeam(context.TODO(), args[0], "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), args[0], "").
|
||||
GetTeamByName(context.TODO(), args[0], "").
|
||||
Return(foundTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateTeam(context.Background(), updatedTeam).
|
||||
UpdateTeam(context.TODO(), updatedTeam).
|
||||
Return(updatedTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -248,7 +248,7 @@ func (s *MmctlUnitTestSuite) TestListTeamsCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetAllTeams(context.Background(), "", 0, APILimitMaximum).
|
||||
GetAllTeams(context.TODO(), "", 0, APILimitMaximum).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -266,7 +266,7 @@ func (s *MmctlUnitTestSuite) TestListTeamsCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetAllTeams(context.Background(), "", 0, APILimitMaximum).
|
||||
GetAllTeams(context.TODO(), "", 0, APILimitMaximum).
|
||||
Return([]*model.Team{&mockTeam}, &model.Response{}, nil).
|
||||
Times(2)
|
||||
|
||||
@ -300,7 +300,7 @@ func (s *MmctlUnitTestSuite) TestListTeamsCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetAllTeams(context.Background(), "", 0, APILimitMaximum).
|
||||
GetAllTeams(context.TODO(), "", 0, APILimitMaximum).
|
||||
Return([]*model.Team{&mockTeam}, &model.Response{}, nil).
|
||||
Times(2)
|
||||
|
||||
@ -347,7 +347,7 @@ func (s *MmctlUnitTestSuite) TestListTeamsCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetAllTeams(context.Background(), "", 0, APILimitMaximum).
|
||||
GetAllTeams(context.TODO(), "", 0, APILimitMaximum).
|
||||
Return(mockTeams, &model.Response{}, nil).
|
||||
Times(2)
|
||||
|
||||
@ -391,13 +391,13 @@ func (s *MmctlUnitTestSuite) TestListTeamsCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetAllTeams(context.Background(), "", 0, APILimitMaximum).
|
||||
GetAllTeams(context.TODO(), "", 0, APILimitMaximum).
|
||||
Return(mockTeamsPage1, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetAllTeams(context.Background(), "", 1, APILimitMaximum).
|
||||
GetAllTeams(context.TODO(), "", 1, APILimitMaximum).
|
||||
Return(mockTeamsPage2, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -428,13 +428,13 @@ func (s *MmctlUnitTestSuite) TestDeleteTeamsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamName, "").
|
||||
GetTeamByName(context.TODO(), teamName, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -455,13 +455,13 @@ func (s *MmctlUnitTestSuite) TestDeleteTeamsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PermanentDeleteTeam(context.Background(), teamID).
|
||||
PermanentDeleteTeam(context.TODO(), teamID).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -484,13 +484,13 @@ func (s *MmctlUnitTestSuite) TestDeleteTeamsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PermanentDeleteTeam(context.Background(), teamID).
|
||||
PermanentDeleteTeam(context.TODO(), teamID).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -512,7 +512,7 @@ func (s *MmctlUnitTestSuite) TestSearchTeamCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SearchTeams(context.Background(), &model.TeamSearch{Term: teamName}).
|
||||
SearchTeams(context.TODO(), &model.TeamSearch{Term: teamName}).
|
||||
Return([]*model.Team{mockTeam}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -530,7 +530,7 @@ func (s *MmctlUnitTestSuite) TestSearchTeamCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SearchTeams(context.Background(), &model.TeamSearch{Term: displayName}).
|
||||
SearchTeams(context.TODO(), &model.TeamSearch{Term: displayName}).
|
||||
Return([]*model.Team{mockTeam}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -547,7 +547,7 @@ func (s *MmctlUnitTestSuite) TestSearchTeamCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SearchTeams(context.Background(), &model.TeamSearch{Term: teamName}).
|
||||
SearchTeams(context.TODO(), &model.TeamSearch{Term: teamName}).
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -564,7 +564,7 @@ func (s *MmctlUnitTestSuite) TestSearchTeamCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SearchTeams(context.Background(), &model.TeamSearch{Term: displayName}).
|
||||
SearchTeams(context.TODO(), &model.TeamSearch{Term: displayName}).
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -585,13 +585,13 @@ func (s *MmctlUnitTestSuite) TestSearchTeamCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SearchTeams(context.Background(), &model.TeamSearch{Term: mockTeam1Name}).
|
||||
SearchTeams(context.TODO(), &model.TeamSearch{Term: mockTeam1Name}).
|
||||
Return([]*model.Team{mockTeam1}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SearchTeams(context.Background(), &model.TeamSearch{Term: mockTeam2DisplayName}).
|
||||
SearchTeams(context.TODO(), &model.TeamSearch{Term: mockTeam2DisplayName}).
|
||||
Return([]*model.Team{mockTeam2}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -612,7 +612,7 @@ func (s *MmctlUnitTestSuite) TestSearchTeamCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SearchTeams(context.Background(), &model.TeamSearch{Term: teamVariableName}).
|
||||
SearchTeams(context.TODO(), &model.TeamSearch{Term: teamVariableName}).
|
||||
Return([]*model.Team{mockTeam1, mockTeam2}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -635,13 +635,13 @@ func (s *MmctlUnitTestSuite) TestSearchTeamCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SearchTeams(context.Background(), &model.TeamSearch{Term: "team"}).
|
||||
SearchTeams(context.TODO(), &model.TeamSearch{Term: "team"}).
|
||||
Return([]*model.Team{mockTeam1, mockTeam2, mockTeam3, mockTeam4}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SearchTeams(context.Background(), &model.TeamSearch{Term: teamVariableName}).
|
||||
SearchTeams(context.TODO(), &model.TeamSearch{Term: teamVariableName}).
|
||||
Return([]*model.Team{mockTeam1, mockTeam2, mockTeam3, mockTeam4}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -663,7 +663,7 @@ func (s *MmctlUnitTestSuite) TestSearchTeamCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
SearchTeams(context.Background(), &model.TeamSearch{Term: teamVariableName}).
|
||||
SearchTeams(context.TODO(), &model.TeamSearch{Term: teamVariableName}).
|
||||
Return([]*model.Team{mockTeam1, mockTeam2, mockTeam3, mockTeam4, mockTeam5}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -683,7 +683,7 @@ func (s *MmctlUnitTestSuite) TestSearchTeamCmd() {
|
||||
mockError := errors.New("remote error")
|
||||
teamName := "teamName"
|
||||
s.client.EXPECT().
|
||||
SearchTeams(context.Background(), &model.TeamSearch{Term: teamName}).
|
||||
SearchTeams(context.TODO(), &model.TeamSearch{Term: teamName}).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -720,13 +720,13 @@ func (s *MmctlUnitTestSuite) TestModifyTeamsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamName, "").
|
||||
GetTeamByName(context.TODO(), teamName, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -749,13 +749,13 @@ func (s *MmctlUnitTestSuite) TestModifyTeamsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateTeamPrivacy(context.Background(), teamID, model.TeamInvite).
|
||||
UpdateTeamPrivacy(context.TODO(), teamID, model.TeamInvite).
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -778,13 +778,13 @@ func (s *MmctlUnitTestSuite) TestModifyTeamsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateTeamPrivacy(context.Background(), teamID, model.TeamOpen).
|
||||
UpdateTeamPrivacy(context.TODO(), teamID, model.TeamOpen).
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -809,13 +809,13 @@ func (s *MmctlUnitTestSuite) TestModifyTeamsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateTeamPrivacy(context.Background(), teamID, model.TeamOpen).
|
||||
UpdateTeamPrivacy(context.TODO(), teamID, model.TeamOpen).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -839,13 +839,13 @@ func (s *MmctlUnitTestSuite) TestRestoreTeamsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamName, "").
|
||||
GetTeamByName(context.TODO(), teamName, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -865,13 +865,13 @@ func (s *MmctlUnitTestSuite) TestRestoreTeamsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RestoreTeam(context.Background(), teamID).
|
||||
RestoreTeam(context.TODO(), teamID).
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -891,13 +891,13 @@ func (s *MmctlUnitTestSuite) TestRestoreTeamsCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamName, "").
|
||||
GetTeam(context.TODO(), teamName, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RestoreTeam(context.Background(), teamID).
|
||||
RestoreTeam(context.TODO(), teamID).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
|
@ -22,13 +22,13 @@ func (s *MmctlUnitTestSuite) TestTeamUsersArchiveCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamArg, "").
|
||||
GetTeamByName(context.TODO(), teamArg, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -44,25 +44,25 @@ func (s *MmctlUnitTestSuite) TestTeamUsersArchiveCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Id, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Id, "").
|
||||
Return(nil, nil, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), mockUser.Id, "").
|
||||
GetUserByUsername(context.TODO(), mockUser.Id, "").
|
||||
Return(nil, nil, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), mockUser.Id, "").
|
||||
GetUser(context.TODO(), mockUser.Id, "").
|
||||
Return(nil, nil, nil).
|
||||
Times(1)
|
||||
|
||||
@ -80,25 +80,25 @@ func (s *MmctlUnitTestSuite) TestTeamUsersArchiveCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(nil, nil, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), teamArg, "").
|
||||
GetTeamByName(context.TODO(), teamArg, "").
|
||||
Return(mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Id, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Id, "").
|
||||
Return(mockUser, nil, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveTeamMember(context.Background(), mockTeam.Id, mockUser.Id).
|
||||
RemoveTeamMember(context.TODO(), mockTeam.Id, mockUser.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -115,19 +115,19 @@ func (s *MmctlUnitTestSuite) TestTeamUsersArchiveCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Id, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Id, "").
|
||||
Return(mockUser, nil, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveTeamMember(context.Background(), mockTeam.Id, mockUser.Id).
|
||||
RemoveTeamMember(context.TODO(), mockTeam.Id, mockUser.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -144,25 +144,25 @@ func (s *MmctlUnitTestSuite) TestTeamUsersArchiveCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Id, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Id, "").
|
||||
Return(nil, nil, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), mockUser.Id, "").
|
||||
GetUserByUsername(context.TODO(), mockUser.Id, "").
|
||||
Return(mockUser, nil, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveTeamMember(context.Background(), mockTeam.Id, mockUser.Id).
|
||||
RemoveTeamMember(context.TODO(), mockTeam.Id, mockUser.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -178,31 +178,31 @@ func (s *MmctlUnitTestSuite) TestTeamUsersArchiveCmd() {
|
||||
mockUser := &model.User{Id: userArg}
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Id, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Id, "").
|
||||
Return(nil, nil, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), mockUser.Id, "").
|
||||
GetUserByUsername(context.TODO(), mockUser.Id, "").
|
||||
Return(nil, nil, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), mockUser.Id, "").
|
||||
GetUser(context.TODO(), mockUser.Id, "").
|
||||
Return(mockUser, nil, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveTeamMember(context.Background(), mockTeam.Id, mockUser.Id).
|
||||
RemoveTeamMember(context.TODO(), mockTeam.Id, mockUser.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -220,19 +220,19 @@ func (s *MmctlUnitTestSuite) TestTeamUsersArchiveCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamArg, "").
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
Return(mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), mockUser.Id, "").
|
||||
GetUserByEmail(context.TODO(), mockUser.Id, "").
|
||||
Return(mockUser, nil, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
RemoveTeamMember(context.Background(), mockTeam.Id, mockUser.Id).
|
||||
RemoveTeamMember(context.TODO(), mockTeam.Id, mockUser.Id).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -261,13 +261,13 @@ func (s *MmctlUnitTestSuite) TestAddUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), "team1", "").
|
||||
GetTeam(context.TODO(), "team1", "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), "team1", "").
|
||||
GetTeamByName(context.TODO(), "team1", "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -282,25 +282,25 @@ func (s *MmctlUnitTestSuite) TestAddUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), "team1", "").
|
||||
GetTeam(context.TODO(), "team1", "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), "user1", "").
|
||||
GetUserByEmail(context.TODO(), "user1", "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), "user1", "").
|
||||
GetUserByUsername(context.TODO(), "user1", "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), "user1", "").
|
||||
GetUser(context.TODO(), "user1", "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -316,13 +316,13 @@ func (s *MmctlUnitTestSuite) TestAddUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), "team1", "").
|
||||
GetTeam(context.TODO(), "team1", "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), "user1", "").
|
||||
GetUserByEmail(context.TODO(), "user1", "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -330,7 +330,7 @@ func (s *MmctlUnitTestSuite) TestAddUsersCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
AddTeamMember(context.Background(), "TeamId", "UserID").
|
||||
AddTeamMember(context.TODO(), "TeamId", "UserID").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -347,19 +347,19 @@ func (s *MmctlUnitTestSuite) TestAddUsersCmd() {
|
||||
cmd := &cobra.Command{}
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), "team1", "").
|
||||
GetTeam(context.TODO(), "team1", "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), "user1", "").
|
||||
GetUserByEmail(context.TODO(), "user1", "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
AddTeamMember(context.Background(), "TeamId", "UserID").
|
||||
AddTeamMember(context.TODO(), "TeamId", "UserID").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -19,12 +19,12 @@ func (s *MmctlUnitTestSuite) TestGetTeamArgs() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), notFoundTeam, "").
|
||||
GetTeam(context.TODO(), notFoundTeam, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, notFoundErr).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), notFoundTeam, "").
|
||||
GetTeamByName(context.TODO(), notFoundTeam, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, notFoundErr).
|
||||
Times(1)
|
||||
|
||||
@ -39,12 +39,12 @@ func (s *MmctlUnitTestSuite) TestGetTeamArgs() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), badRequestTeam, "").
|
||||
GetTeam(context.TODO(), badRequestTeam, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusBadRequest}, badRequestErr).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeamByName(context.Background(), badRequestTeam, "").
|
||||
GetTeamByName(context.TODO(), badRequestTeam, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusBadRequest}, badRequestErr).
|
||||
Times(1)
|
||||
|
||||
@ -59,7 +59,7 @@ func (s *MmctlUnitTestSuite) TestGetTeamArgs() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), forbidden, "").
|
||||
GetTeam(context.TODO(), forbidden, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusForbidden}, forbiddenErr).
|
||||
Times(1)
|
||||
|
||||
@ -74,7 +74,7 @@ func (s *MmctlUnitTestSuite) TestGetTeamArgs() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), errTeam, "").
|
||||
GetTeam(context.TODO(), errTeam, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusInternalServerError}, internalServerErrorErr).
|
||||
Times(1)
|
||||
|
||||
@ -89,7 +89,7 @@ func (s *MmctlUnitTestSuite) TestGetTeamArgs() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), successID, "").
|
||||
GetTeam(context.TODO(), successID, "").
|
||||
Return(successTeam, nil, nil).
|
||||
Times(1)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -1073,14 +1073,14 @@ func (s *MmctlE2ETestSuite) cleanUpPreferences(userID string) {
|
||||
s.T().Helper()
|
||||
|
||||
// Delete any existing preferences
|
||||
preferences, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), userID)
|
||||
preferences, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), userID)
|
||||
s.NoError(err)
|
||||
|
||||
if len(preferences) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = s.th.SystemAdminClient.DeletePreferences(context.Background(), userID, preferences)
|
||||
_, err = s.th.SystemAdminClient.DeletePreferences(context.TODO(), userID, preferences)
|
||||
s.NoError(err)
|
||||
}
|
||||
|
||||
@ -1091,17 +1091,17 @@ func (s *MmctlE2ETestSuite) TestPreferenceListCmd() {
|
||||
s.cleanUpPreferences(s.th.BasicUser2.Id)
|
||||
|
||||
preference1 := model.Preference{UserId: s.th.BasicUser.Id, Category: "display_settings", Name: "collapsed_reply_threads", Value: "threads_view"}
|
||||
_, err := s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference1})
|
||||
_, err := s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference1})
|
||||
s.NoError(err)
|
||||
preference2 := model.Preference{UserId: s.th.BasicUser.Id, Category: "display_settings", Name: "colorize_usernames", Value: "threads_view"}
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference2})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference2})
|
||||
s.NoError(err)
|
||||
preference3 := model.Preference{UserId: s.th.BasicUser.Id, Category: "drafts", Name: "drafts_tour_tip_showed", Value: `{"drafts_tour_tip_showed":true}`}
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference3})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference3})
|
||||
s.NoError(err)
|
||||
|
||||
preference4 := model.Preference{UserId: s.th.BasicUser2.Id, Category: "display_settings", Name: "collapsed_reply_threads", Value: "threads_view"}
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser2.Id, model.Preferences{preference4})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser2.Id, model.Preferences{preference4})
|
||||
s.NoError(err)
|
||||
|
||||
s.Run("list all preferences for single user", func() {
|
||||
@ -1182,17 +1182,17 @@ func (s *MmctlE2ETestSuite) TestPreferenceGetCmd() {
|
||||
s.cleanUpPreferences(s.th.BasicUser2.Id)
|
||||
|
||||
preference1 := model.Preference{UserId: s.th.BasicUser.Id, Category: "display_settings", Name: "collapsed_reply_threads", Value: "threads_view"}
|
||||
_, err := s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference1})
|
||||
_, err := s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference1})
|
||||
s.NoError(err)
|
||||
preference2 := model.Preference{UserId: s.th.BasicUser.Id, Category: "display_settings", Name: "colorize_usernames", Value: "threads_view"}
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference2})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference2})
|
||||
s.NoError(err)
|
||||
preference3 := model.Preference{UserId: s.th.BasicUser.Id, Category: "drafts", Name: "drafts_tour_tip_showed", Value: `{"drafts_tour_tip_showed":true}`}
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference3})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference3})
|
||||
s.NoError(err)
|
||||
|
||||
preference4 := model.Preference{UserId: s.th.BasicUser2.Id, Category: "display_settings", Name: "collapsed_reply_threads", Value: "threads_view"}
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser2.Id, model.Preferences{preference4})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser2.Id, model.Preferences{preference4})
|
||||
s.NoError(err)
|
||||
|
||||
s.Run("get preference for single user", func() {
|
||||
@ -1251,14 +1251,14 @@ func (s *MmctlE2ETestSuite) TestPreferenceUpdateCmd() {
|
||||
s.cleanUpPreferences(s.th.BasicUser.Id)
|
||||
s.cleanUpPreferences(s.th.BasicUser2.Id)
|
||||
|
||||
_, err := s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference1})
|
||||
_, err := s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference1})
|
||||
s.NoError(err)
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference2})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference2})
|
||||
s.NoError(err)
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference3})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference3})
|
||||
s.NoError(err)
|
||||
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser2.Id, model.Preferences{preference4})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser2.Id, model.Preferences{preference4})
|
||||
s.NoError(err)
|
||||
}
|
||||
|
||||
@ -1277,7 +1277,7 @@ func (s *MmctlE2ETestSuite) TestPreferenceUpdateCmd() {
|
||||
s.Require().NoError(err)
|
||||
s.Require().Len(printer.GetErrorLines(), 0)
|
||||
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser.Id)
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser1, 4)
|
||||
s.Require().Equal(preference1, actualPreferencesUser1[0])
|
||||
@ -1286,7 +1286,7 @@ func (s *MmctlE2ETestSuite) TestPreferenceUpdateCmd() {
|
||||
s.Require().Equal(preferenceNew, actualPreferencesUser1[3])
|
||||
|
||||
// Second user unaffected
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser2.Id)
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser2.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser2, 1)
|
||||
s.Require().Equal(preference4, actualPreferencesUser2[0])
|
||||
@ -1308,7 +1308,7 @@ func (s *MmctlE2ETestSuite) TestPreferenceUpdateCmd() {
|
||||
s.Require().NoError(err)
|
||||
s.Require().Len(printer.GetErrorLines(), 0)
|
||||
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser.Id)
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser1, 4)
|
||||
s.Require().Equal(preference1, actualPreferencesUser1[0])
|
||||
@ -1317,7 +1317,7 @@ func (s *MmctlE2ETestSuite) TestPreferenceUpdateCmd() {
|
||||
s.Require().Equal(preferenceNew, actualPreferencesUser1[3])
|
||||
|
||||
// Second user unaffected
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser2.Id)
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser2.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser2, 2)
|
||||
s.Require().Equal(preference4, actualPreferencesUser2[0])
|
||||
@ -1354,7 +1354,7 @@ func (s *MmctlE2ETestSuite) TestPreferenceUpdateCmd() {
|
||||
s.Require().NoError(err)
|
||||
s.Require().Len(printer.GetErrorLines(), 0)
|
||||
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser.Id)
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser1, 3)
|
||||
s.Require().Equal(preferenceUpdated, actualPreferencesUser1[0])
|
||||
@ -1362,7 +1362,7 @@ func (s *MmctlE2ETestSuite) TestPreferenceUpdateCmd() {
|
||||
s.Require().Equal(preference3, actualPreferencesUser1[2])
|
||||
|
||||
// Second user unaffected
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser2.Id)
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser2.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser2, 1)
|
||||
s.Require().Equal(preference4, actualPreferencesUser2[0])
|
||||
@ -1384,14 +1384,14 @@ func (s *MmctlE2ETestSuite) TestPreferenceUpdateCmd() {
|
||||
s.Require().NoError(err)
|
||||
s.Require().Len(printer.GetErrorLines(), 0)
|
||||
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser.Id)
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser1, 3)
|
||||
s.Require().Equal(preferenceUpdated, actualPreferencesUser1[0])
|
||||
s.Require().Equal(preference2, actualPreferencesUser1[1])
|
||||
s.Require().Equal(preference3, actualPreferencesUser1[2])
|
||||
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser2.Id)
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser2.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser2, 1)
|
||||
s.Require().Equal(preferenceUpdated2, actualPreferencesUser2[0])
|
||||
@ -1420,17 +1420,17 @@ func (s *MmctlE2ETestSuite) TestPreferenceDeleteCmd() {
|
||||
s.cleanUpPreferences(s.th.BasicUser2.Id)
|
||||
|
||||
preference1 := model.Preference{UserId: s.th.BasicUser.Id, Category: "display_settings", Name: "collapsed_reply_threads", Value: "threads_view"}
|
||||
_, err := s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference1})
|
||||
_, err := s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference1})
|
||||
s.NoError(err)
|
||||
preference2 := model.Preference{UserId: s.th.BasicUser.Id, Category: "display_settings", Name: "colorize_usernames", Value: "threads_view"}
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference2})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference2})
|
||||
s.NoError(err)
|
||||
preference3 := model.Preference{UserId: s.th.BasicUser.Id, Category: "drafts", Name: "drafts_tour_tip_showed", Value: `{"drafts_tour_tip_showed":true}`}
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser.Id, model.Preferences{preference3})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser.Id, model.Preferences{preference3})
|
||||
s.NoError(err)
|
||||
|
||||
preference4 := model.Preference{UserId: s.th.BasicUser2.Id, Category: "display_settings", Name: "collapsed_reply_threads", Value: "threads_view"}
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.Background(), s.th.BasicUser2.Id, model.Preferences{preference4})
|
||||
_, err = s.th.SystemAdminClient.UpdatePreferences(context.TODO(), s.th.BasicUser2.Id, model.Preferences{preference4})
|
||||
s.NoError(err)
|
||||
|
||||
s.Run("delete non-existing preference for single user", func() {
|
||||
@ -1446,7 +1446,7 @@ func (s *MmctlE2ETestSuite) TestPreferenceDeleteCmd() {
|
||||
s.Require().NoError(err)
|
||||
s.Require().Len(printer.GetErrorLines(), 0)
|
||||
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser.Id)
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser1, 3)
|
||||
s.Require().Equal(preference1, actualPreferencesUser1[0])
|
||||
@ -1454,7 +1454,7 @@ func (s *MmctlE2ETestSuite) TestPreferenceDeleteCmd() {
|
||||
s.Require().Equal(preference3, actualPreferencesUser1[2])
|
||||
|
||||
// Second user unaffected
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser2.Id)
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser2.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser2, 1)
|
||||
s.Require().Equal(preference4, actualPreferencesUser2[0])
|
||||
@ -1471,14 +1471,14 @@ func (s *MmctlE2ETestSuite) TestPreferenceDeleteCmd() {
|
||||
s.Require().NoError(err)
|
||||
s.Require().Len(printer.GetErrorLines(), 0)
|
||||
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser.Id)
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser1, 2)
|
||||
s.Require().Equal(preference2, actualPreferencesUser1[0])
|
||||
s.Require().Equal(preference3, actualPreferencesUser1[1])
|
||||
|
||||
// Second user unaffected
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser2.Id)
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser2.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser2, 1)
|
||||
s.Require().Equal(preference4, actualPreferencesUser2[0])
|
||||
@ -1495,14 +1495,14 @@ func (s *MmctlE2ETestSuite) TestPreferenceDeleteCmd() {
|
||||
s.Require().NoError(err)
|
||||
s.Require().Len(printer.GetErrorLines(), 0)
|
||||
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser.Id)
|
||||
actualPreferencesUser1, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser1, 2)
|
||||
s.Require().Equal(preference2, actualPreferencesUser1[0])
|
||||
s.Require().Equal(preference3, actualPreferencesUser1[1])
|
||||
|
||||
// Second user unaffected
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.Background(), s.th.BasicUser2.Id)
|
||||
actualPreferencesUser2, _, err := s.th.SystemAdminClient.GetPreferences(context.TODO(), s.th.BasicUser2.Id)
|
||||
s.NoError(err)
|
||||
s.Require().Len(actualPreferencesUser2, 0)
|
||||
})
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,17 +20,17 @@ func (s *MmctlUnitTestSuite) TestGetUserFromArgs() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), notFoundEmail, "").
|
||||
GetUserByEmail(context.TODO(), notFoundEmail, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, notFoundErr).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), notFoundEmail, "").
|
||||
GetUserByUsername(context.TODO(), notFoundEmail, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, notFoundErr).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), notFoundEmail, "").
|
||||
GetUser(context.TODO(), notFoundEmail, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusNotFound}, notFoundErr).
|
||||
Times(1)
|
||||
|
||||
@ -46,17 +46,17 @@ func (s *MmctlUnitTestSuite) TestGetUserFromArgs() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), badRequestEmail, "").
|
||||
GetUserByEmail(context.TODO(), badRequestEmail, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusBadRequest}, badRequestErr).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.Background(), badRequestEmail, "").
|
||||
GetUserByUsername(context.TODO(), badRequestEmail, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusBadRequest}, badRequestErr).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUser(context.Background(), badRequestEmail, "").
|
||||
GetUser(context.TODO(), badRequestEmail, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusBadRequest}, badRequestErr).
|
||||
Times(1)
|
||||
|
||||
@ -72,7 +72,7 @@ func (s *MmctlUnitTestSuite) TestGetUserFromArgs() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), unexpectedErrEmail, "").
|
||||
GetUserByEmail(context.TODO(), unexpectedErrEmail, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusInternalServerError}, unexpectedErr).
|
||||
Times(1)
|
||||
users, err := getUsersFromArgs(s.client, []string{unexpectedErrEmail})
|
||||
@ -86,7 +86,7 @@ func (s *MmctlUnitTestSuite) TestGetUserFromArgs() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), forbiddenErrEmail, "").
|
||||
GetUserByEmail(context.TODO(), forbiddenErrEmail, "").
|
||||
Return(nil, &model.Response{StatusCode: http.StatusForbidden}, forbiddenErr).
|
||||
Times(1)
|
||||
users, err := getUsersFromArgs(s.client, []string{forbiddenErrEmail})
|
||||
@ -100,7 +100,7 @@ func (s *MmctlUnitTestSuite) TestGetUserFromArgs() {
|
||||
printer.Clean()
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), successEmail, "").
|
||||
GetUserByEmail(context.TODO(), successEmail, "").
|
||||
Return(successUser, nil, nil).
|
||||
Times(1)
|
||||
users, err := getUsersFromArgs(s.client, []string{successEmail})
|
||||
|
@ -40,19 +40,19 @@ func (s *MmctlUnitTestSuite) TestListWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetAllTeams(context.Background(), "", 0, 100000000).
|
||||
GetAllTeams(context.TODO(), "", 0, 100000000).
|
||||
Return([]*model.Team{&mockTeam}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhooksForTeam(context.Background(), teamID, 0, 100000000, "").
|
||||
GetIncomingWebhooksForTeam(context.TODO(), teamID, 0, 100000000, "").
|
||||
Return([]*model.IncomingWebhook{&mockIncomingWebhook}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetOutgoingWebhooksForTeam(context.Background(), teamID, 0, 100000000, "").
|
||||
GetOutgoingWebhooksForTeam(context.TODO(), teamID, 0, 100000000, "").
|
||||
Return([]*model.OutgoingWebhook{&mockOutgoingWebhook}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -80,19 +80,19 @@ func (s *MmctlUnitTestSuite) TestListWebhookCmd() {
|
||||
}
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhooksForTeam(context.Background(), teamID, 0, 100000000, "").
|
||||
GetIncomingWebhooksForTeam(context.TODO(), teamID, 0, 100000000, "").
|
||||
Return([]*model.IncomingWebhook{&mockIncomingWebhook}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetOutgoingWebhooksForTeam(context.Background(), teamID, 0, 100000000, "").
|
||||
GetOutgoingWebhooksForTeam(context.TODO(), teamID, 0, 100000000, "").
|
||||
Return([]*model.OutgoingWebhook{&mockOutgoingWebhook}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -114,19 +114,19 @@ func (s *MmctlUnitTestSuite) TestListWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetAllTeams(context.Background(), "", 0, 100000000).
|
||||
GetAllTeams(context.TODO(), "", 0, 100000000).
|
||||
Return([]*model.Team{&mockTeam}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhooksForTeam(context.Background(), teamID, 0, 100000000, "").
|
||||
GetIncomingWebhooksForTeam(context.TODO(), teamID, 0, 100000000, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetOutgoingWebhooksForTeam(context.Background(), teamID, 0, 100000000, "").
|
||||
GetOutgoingWebhooksForTeam(context.TODO(), teamID, 0, 100000000, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -174,19 +174,19 @@ func (s *MmctlUnitTestSuite) TestCreateIncomingWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelID, "").
|
||||
GetChannel(context.TODO(), channelID, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), emailID, "").
|
||||
GetUserByEmail(context.TODO(), emailID, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateIncomingWebhook(context.Background(), &mockIncomingWebhook).
|
||||
CreateIncomingWebhook(context.TODO(), &mockIncomingWebhook).
|
||||
Return(&returnedIncomingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -218,19 +218,19 @@ func (s *MmctlUnitTestSuite) TestCreateIncomingWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetChannel(context.Background(), channelID, "").
|
||||
GetChannel(context.TODO(), channelID, "").
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), emailID, "").
|
||||
GetUserByEmail(context.TODO(), emailID, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateIncomingWebhook(context.Background(), &mockIncomingWebhook).
|
||||
CreateIncomingWebhook(context.TODO(), &mockIncomingWebhook).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -269,13 +269,13 @@ func (s *MmctlUnitTestSuite) TestModifyIncomingWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhook(context.Background(), incomingWebhookID, "").
|
||||
GetIncomingWebhook(context.TODO(), incomingWebhookID, "").
|
||||
Return(&mockIncomingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateIncomingWebhook(context.Background(), &mockIncomingWebhook).
|
||||
UpdateIncomingWebhook(context.TODO(), &mockIncomingWebhook).
|
||||
Return(&updatedIncomingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -307,13 +307,13 @@ func (s *MmctlUnitTestSuite) TestModifyIncomingWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhook(context.Background(), incomingWebhookID, "").
|
||||
GetIncomingWebhook(context.TODO(), incomingWebhookID, "").
|
||||
Return(&mockIncomingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateIncomingWebhook(context.Background(), &mockIncomingWebhook).
|
||||
UpdateIncomingWebhook(context.TODO(), &mockIncomingWebhook).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -363,19 +363,19 @@ func (s *MmctlUnitTestSuite) TestCreateOutgoingWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), emailID, "").
|
||||
GetUserByEmail(context.TODO(), emailID, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateOutgoingWebhook(context.Background(), &mockOutgoingWebhook).
|
||||
CreateOutgoingWebhook(context.TODO(), &mockOutgoingWebhook).
|
||||
Return(&createdOutgoingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -409,19 +409,19 @@ func (s *MmctlUnitTestSuite) TestCreateOutgoingWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.Background(), teamID, "").
|
||||
GetTeam(context.TODO(), teamID, "").
|
||||
Return(&mockTeam, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.Background(), emailID, "").
|
||||
GetUserByEmail(context.TODO(), emailID, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateOutgoingWebhook(context.Background(), &mockOutgoingWebhook).
|
||||
CreateOutgoingWebhook(context.TODO(), &mockOutgoingWebhook).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -456,13 +456,13 @@ func (s *MmctlUnitTestSuite) TestModifyOutgoingWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetOutgoingWebhook(context.Background(), outgoingWebhookID).
|
||||
GetOutgoingWebhook(context.TODO(), outgoingWebhookID).
|
||||
Return(&mockOutgoingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateOutgoingWebhook(context.Background(), &mockOutgoingWebhook).
|
||||
UpdateOutgoingWebhook(context.TODO(), &mockOutgoingWebhook).
|
||||
Return(&updatedOutgoingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -491,13 +491,13 @@ func (s *MmctlUnitTestSuite) TestModifyOutgoingWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetOutgoingWebhook(context.Background(), outgoingWebhookID).
|
||||
GetOutgoingWebhook(context.TODO(), outgoingWebhookID).
|
||||
Return(&mockOutgoingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
UpdateOutgoingWebhook(context.Background(), &mockOutgoingWebhook).
|
||||
UpdateOutgoingWebhook(context.TODO(), &mockOutgoingWebhook).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -520,13 +520,13 @@ func (s *MmctlUnitTestSuite) TestDeleteWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhook(context.Background(), incomingWebhookID, "").
|
||||
GetIncomingWebhook(context.TODO(), incomingWebhookID, "").
|
||||
Return(&mockIncomingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DeleteIncomingWebhook(context.Background(), incomingWebhookID).
|
||||
DeleteIncomingWebhook(context.TODO(), incomingWebhookID).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -545,19 +545,19 @@ func (s *MmctlUnitTestSuite) TestDeleteWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhook(context.Background(), outgoingWebhookID, "").
|
||||
GetIncomingWebhook(context.TODO(), outgoingWebhookID, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetOutgoingWebhook(context.Background(), outgoingWebhookID).
|
||||
GetOutgoingWebhook(context.TODO(), outgoingWebhookID).
|
||||
Return(&mockOutgoingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DeleteOutgoingWebhook(context.Background(), outgoingWebhookID).
|
||||
DeleteOutgoingWebhook(context.TODO(), outgoingWebhookID).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -576,13 +576,13 @@ func (s *MmctlUnitTestSuite) TestDeleteWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhook(context.Background(), incomingWebhookID, "").
|
||||
GetIncomingWebhook(context.TODO(), incomingWebhookID, "").
|
||||
Return(&mockIncomingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DeleteIncomingWebhook(context.Background(), incomingWebhookID).
|
||||
DeleteIncomingWebhook(context.TODO(), incomingWebhookID).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -601,19 +601,19 @@ func (s *MmctlUnitTestSuite) TestDeleteWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhook(context.Background(), outgoingWebhookID, "").
|
||||
GetIncomingWebhook(context.TODO(), outgoingWebhookID, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetOutgoingWebhook(context.Background(), outgoingWebhookID).
|
||||
GetOutgoingWebhook(context.TODO(), outgoingWebhookID).
|
||||
Return(&mockOutgoingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DeleteOutgoingWebhook(context.Background(), outgoingWebhookID).
|
||||
DeleteOutgoingWebhook(context.TODO(), outgoingWebhookID).
|
||||
Return(&model.Response{StatusCode: http.StatusBadRequest}, mockError).
|
||||
Times(1)
|
||||
|
||||
@ -637,7 +637,7 @@ func (s *MmctlUnitTestSuite) TestShowWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhook(context.Background(), incomingWebhookID, "").
|
||||
GetIncomingWebhook(context.TODO(), incomingWebhookID, "").
|
||||
Return(&mockIncomingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -656,13 +656,13 @@ func (s *MmctlUnitTestSuite) TestShowWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhook(context.Background(), outgoingWebhookID, "").
|
||||
GetIncomingWebhook(context.TODO(), outgoingWebhookID, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetOutgoingWebhook(context.Background(), outgoingWebhookID).
|
||||
GetOutgoingWebhook(context.TODO(), outgoingWebhookID).
|
||||
Return(&mockOutgoingWebhook, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@ -680,13 +680,13 @@ func (s *MmctlUnitTestSuite) TestShowWebhookCmd() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetIncomingWebhook(context.Background(), nonExistentID, "").
|
||||
GetIncomingWebhook(context.TODO(), nonExistentID, "").
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetOutgoingWebhook(context.Background(), nonExistentID).
|
||||
GetOutgoingWebhook(context.TODO(), nonExistentID).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
module github.com/mattermost/mattermost/server/v8
|
||||
|
||||
go 1.20
|
||||
go 1.21
|
||||
|
||||
toolchain go1.21.8
|
||||
|
||||
require (
|
||||
code.sajari.com/docconv/v2 v2.0.0-pre.4
|
||||
|
@ -1,6 +1,8 @@
|
||||
module github.com/mattermost/mattermost/server/public
|
||||
|
||||
go 1.20
|
||||
go 1.21
|
||||
|
||||
toolchain go1.21.8
|
||||
|
||||
require (
|
||||
github.com/blang/semver/v4 v4.0.0
|
||||
|
@ -9,6 +9,7 @@ dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D
|
||||
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
|
||||
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
|
||||
@ -17,6 +18,7 @@ github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4Yn
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
|
||||
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
|
||||
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
|
||||
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
|
||||
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
@ -58,6 +60,7 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
@ -82,6 +85,7 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE
|
||||
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
||||
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
|
||||
github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c=
|
||||
github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
@ -265,6 +269,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
Loading…
Reference in New Issue
Block a user