Skip to content

Commit f2a26f0

Browse files
authored
test: mock context in TableTestCommand.ExpectedAsserts (#24)
* refactor: Add slackcontext package to DRY context management * refactor: Revert changes to unrelated error codes * test: mock context in TableTestCommand * test: mock context in TableTestCommand ExpectedAsserts * test: use ctx in mocked ExpectedAsserts * test: use ctx in mocked ExpectedAsserts to link_test.go * test: use ctx in mocked ExpectedAsserts to update_test.go * test: update context references for .Setup
1 parent bd884b6 commit f2a26f0

34 files changed

+225
-226
lines changed

cmd/app/add_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ func TestAppAddCommand(t *testing.T) {
352352
mockProjectConfig.On("Cache").Return(mockProjectCache)
353353
cm.Config.ProjectConfig = mockProjectConfig
354354
},
355-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
355+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
356356
cm.ApiInterface.AssertCalled(t, "DeveloperAppInstall", mock.Anything, mock.Anything, mockOrgAuth.Token, mock.Anything, mock.Anything, mock.Anything, "T123", mock.Anything)
357357
},
358358
},

cmd/app/delete_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func TestAppsDeleteCommand(t *testing.T) {
7474
appClientMock.On("Remove", mock.Anything, mock.Anything).Return(fakeDeployedApp, nil)
7575
cf.AppClient().AppClientInterface = appClientMock
7676
},
77-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
77+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
7878
cm.ApiInterface.AssertCalled(t, "DeleteApp", mock.Anything, mock.Anything, fakeDeployedApp.AppID)
7979
},
8080
ExpectedStdoutOutputs: []string{
@@ -107,7 +107,7 @@ func TestAppsDeleteCommand(t *testing.T) {
107107
appClientMock.On("Remove", mock.Anything, mock.Anything).Return(fakeLocalApp, nil)
108108
cf.AppClient().AppClientInterface = appClientMock
109109
},
110-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
110+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
111111
cm.ApiInterface.AssertCalled(t, "DeleteApp", mock.Anything, mock.Anything, fakeLocalApp.AppID)
112112
},
113113
ExpectedStdoutOutputs: []string{

cmd/app/link_test.go

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ func Test_Apps_Link(t *testing.T) {
9595
).Return(api.GetAppStatusResult{}, nil)
9696
},
9797
CmdArgs: []string{},
98-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
98+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
9999
expectedApp := types.App{
100100
AppID: mockLinkAppID1,
101101
TeamDomain: mockLinkSlackAuth1.TeamDomain,
102102
TeamID: mockLinkSlackAuth1.TeamID,
103103
EnterpriseID: mockLinkSlackAuth1.EnterpriseID,
104104
}
105105
actualApp, err := cm.AppClient.GetDeployed(
106-
context.Background(),
106+
ctx,
107107
mockLinkSlackAuth1.TeamID,
108108
)
109109
require.NoError(t, err)
@@ -153,7 +153,7 @@ func Test_Apps_Link(t *testing.T) {
153153
).Return(api.GetAppStatusResult{}, nil)
154154
},
155155
CmdArgs: []string{},
156-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
156+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
157157
expectedApp := types.App{
158158
AppID: mockLinkAppID2,
159159
TeamDomain: mockLinkSlackAuth2.TeamDomain,
@@ -162,7 +162,7 @@ func Test_Apps_Link(t *testing.T) {
162162
UserID: mockLinkSlackAuth2.UserID,
163163
}
164164
actualApp, err := cm.AppClient.GetLocal(
165-
context.Background(),
165+
ctx,
166166
mockLinkSlackAuth2.TeamID,
167167
)
168168
require.NoError(t, err)
@@ -220,15 +220,15 @@ func Test_Apps_Link(t *testing.T) {
220220
).Return(api.GetAppStatusResult{}, nil)
221221
},
222222
CmdArgs: []string{},
223-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
223+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
224224
expectedApp := types.App{
225225
AppID: mockLinkAppID1,
226226
TeamDomain: mockLinkSlackAuth1.TeamDomain,
227227
TeamID: mockLinkSlackAuth1.TeamID,
228228
EnterpriseID: mockLinkSlackAuth1.EnterpriseID,
229229
}
230230
actualApp, err := cm.AppClient.GetDeployed(
231-
context.Background(),
231+
ctx,
232232
mockLinkSlackAuth1.TeamID,
233233
)
234234
require.NoError(t, err)
@@ -289,21 +289,21 @@ func Test_Apps_Link(t *testing.T) {
289289
).Return(api.GetAppStatusResult{}, nil)
290290
},
291291
CmdArgs: []string{},
292-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
292+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
293293
expectedApp := types.App{
294294
AppID: mockLinkAppID1,
295295
TeamDomain: mockLinkSlackAuth1.TeamDomain,
296296
TeamID: mockLinkSlackAuth1.TeamID,
297297
EnterpriseID: mockLinkSlackAuth1.EnterpriseID,
298298
}
299299
actualApp, err := cm.AppClient.GetDeployed(
300-
context.Background(),
300+
ctx,
301301
mockLinkSlackAuth1.TeamID,
302302
)
303303
require.NoError(t, err)
304304
assert.Equal(t, expectedApp, actualApp)
305305
unsavedApp, err := cm.AppClient.GetLocal(
306-
context.Background(),
306+
ctx,
307307
mockLinkSlackAuth1.TeamID,
308308
)
309309
require.NoError(t, err)
@@ -365,7 +365,7 @@ func Test_Apps_Link(t *testing.T) {
365365
).Return(api.GetAppStatusResult{}, nil)
366366
},
367367
CmdArgs: []string{"--force"},
368-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
368+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
369369
expectedApp := types.App{
370370
AppID: mockLinkAppID1,
371371
TeamDomain: mockLinkSlackAuth2.TeamDomain,
@@ -374,7 +374,7 @@ func Test_Apps_Link(t *testing.T) {
374374
UserID: mockLinkSlackAuth2.UserID,
375375
}
376376
actualApp, err := cm.AppClient.GetLocal(
377-
context.Background(),
377+
ctx,
378378
mockLinkSlackAuth2.TeamID,
379379
)
380380
require.NoError(t, err)
@@ -481,15 +481,15 @@ func Test_Apps_Link(t *testing.T) {
481481
).Return(api.GetAppStatusResult{}, nil)
482482
},
483483
CmdArgs: []string{},
484-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
484+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
485485
expectedApp := types.App{
486486
AppID: mockLinkAppID1,
487487
TeamDomain: mockLinkSlackAuth1.TeamDomain,
488488
TeamID: mockLinkSlackAuth1.TeamID,
489489
EnterpriseID: mockLinkSlackAuth1.EnterpriseID,
490490
}
491491
actualApp, err := cm.AppClient.GetDeployed(
492-
context.Background(),
492+
ctx,
493493
mockLinkSlackAuth1.TeamID,
494494
)
495495
require.NoError(t, err)
@@ -518,9 +518,7 @@ func Test_Apps_Link(t *testing.T) {
518518
).Return(false, nil)
519519
},
520520
CmdArgs: []string{},
521-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
522-
ctx := t.Context()
523-
521+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
524522
// Assert manifest confirmation prompt accepted
525523
cm.IO.AssertCalled(t, "ConfirmPrompt",
526524
mock.Anything,

cmd/auth/login_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func TestLoginCommmand(t *testing.T) {
157157
nil,
158158
)
159159
},
160-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
160+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
161161
cm.ApiInterface.AssertCalled(t, "ExchangeAuthTicket", mock.Anything, mock.Anything, mockChallengeCode, mock.Anything)
162162
},
163163
},

cmd/auth/logout_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestLogoutCommand(t *testing.T) {
4747
clientsMock.AuthInterface.On("DeleteAuth", mock.Anything, fakeAuthsByTeamSlice[1]).Return(types.SlackAuth{}, nil)
4848
},
4949
ExpectedOutputs: []string{"Authorization successfully revoked for all teams"},
50-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
50+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
5151
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, fakeAuthsByTeamSlice[0].Token)
5252
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, fakeAuthsByTeamSlice[0].RefreshToken)
5353
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, fakeAuthsByTeamSlice[1].Token)
@@ -74,7 +74,7 @@ func TestLogoutCommand(t *testing.T) {
7474
clientsMock.AuthInterface.On("DeleteAuth", mock.Anything, fakeAuthsByTeamSlice[0]).Return(types.SlackAuth{}, nil)
7575
},
7676
ExpectedOutputs: []string{"Authorization successfully revoked for team1"},
77-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
77+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
7878
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, fakeAuthsByTeamSlice[0].Token)
7979
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, fakeAuthsByTeamSlice[0].RefreshToken)
8080
clients.AuthInterface.AssertCalled(t, "DeleteAuth", mock.Anything, fakeAuthsByTeamSlice[0])
@@ -98,7 +98,7 @@ func TestLogoutCommand(t *testing.T) {
9898
clientsMock.AuthInterface.On("DeleteAuth", mock.Anything, fakeAuthsByTeamSlice[1]).Return(types.SlackAuth{}, nil)
9999
},
100100
ExpectedOutputs: []string{"Authorization successfully revoked for team2"},
101-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
101+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
102102
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, fakeAuthsByTeamSlice[1].Token)
103103
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, fakeAuthsByTeamSlice[1].RefreshToken)
104104
clients.AuthInterface.AssertCalled(t, "DeleteAuth", mock.Anything, fakeAuthsByTeamSlice[1])
@@ -108,7 +108,7 @@ func TestLogoutCommand(t *testing.T) {
108108
"require a team value with the flag": {
109109
CmdArgs: []string{"--team", ""},
110110
ExpectedErrorStrings: []string{"The argument is missing from the --team flag (missing_flag)"},
111-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
111+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
112112
clients.AuthInterface.AssertNotCalled(t, "RevokeToken")
113113
clients.IO.AssertNotCalled(t, "SelectPrompt", mock.Anything, "Select an workspace authorization to revoke", mock.Anything, mock.Anything)
114114
},
@@ -125,7 +125,7 @@ func TestLogoutCommand(t *testing.T) {
125125
}, nil)
126126
},
127127
ExpectedErrorStrings: []string{"invalid_auth", "Cannot revoke authentication tokens for 'randomteamdomain'"},
128-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
128+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
129129
clients.AuthInterface.AssertNotCalled(t, "RevokeToken")
130130
clients.IO.AssertCalled(t, "SelectPrompt", mock.Anything, "Select an authorization to revoke", mock.Anything, mock.Anything)
131131
},
@@ -151,7 +151,7 @@ func TestLogoutCommand(t *testing.T) {
151151
clientsMock.AuthInterface.On("DeleteAuth", mock.Anything, fakeAuthsByTeamSlice[1]).Return(types.SlackAuth{}, nil)
152152
},
153153
ExpectedOutputs: []string{"Authorization successfully revoked for team2"},
154-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
154+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
155155
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, fakeAuthsByTeamSlice[1].Token)
156156
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, fakeAuthsByTeamSlice[1].RefreshToken)
157157
clients.AuthInterface.AssertCalled(t, "DeleteAuth", mock.Anything, fakeAuthsByTeamSlice[1])
@@ -171,7 +171,7 @@ func TestLogoutCommand(t *testing.T) {
171171
clientsMock.AuthInterface.On("DeleteAuth", mock.Anything, fakeAuthsByTeamSlice[0]).Return(types.SlackAuth{}, nil)
172172
},
173173
ExpectedOutputs: []string{"Authorization successfully revoked for team1"},
174-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
174+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
175175
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, fakeAuthsByTeamSlice[0].Token)
176176
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, fakeAuthsByTeamSlice[0].RefreshToken)
177177
clients.AuthInterface.AssertCalled(t, "DeleteAuth", mock.Anything, fakeAuthsByTeamSlice[0])
@@ -192,7 +192,7 @@ func TestLogoutCommand(t *testing.T) {
192192
}, nil)
193193
},
194194
ExpectedErrorStrings: []string{"invalid_auth", "Cannot revoke authentication tokens for 'anotherteam'"},
195-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
195+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
196196
clients.AuthInterface.AssertNotCalled(t, "RevokeToken")
197197
clients.IO.AssertCalled(t, "SelectPrompt", mock.Anything, "Select an authorization to revoke", mock.Anything, mock.Anything)
198198
},
@@ -203,7 +203,7 @@ func TestLogoutCommand(t *testing.T) {
203203
clientsMock.AuthInterface.On("Auths", mock.Anything).Return([]types.SlackAuth{}, nil)
204204
},
205205
ExpectedOutputs: []string{"All authorizations successfully revoked"},
206-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
206+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
207207
clients.AuthInterface.AssertNotCalled(t, "RevokeToken")
208208
clients.IO.AssertNotCalled(t, "SelectPrompt", mock.Anything, "Select an authorization to revoke", mock.Anything, mock.Anything)
209209
},
@@ -219,7 +219,7 @@ func TestLogoutCommand(t *testing.T) {
219219
Option: "someteam",
220220
}, nil)
221221
},
222-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
222+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
223223
clients.AuthInterface.AssertNotCalled(t, "RevokeToken")
224224
clients.IO.AssertCalled(t, "SelectPrompt", mock.Anything, "Select an authorization to revoke", mock.Anything, mock.Anything)
225225
},

cmd/auth/revoke_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func TestRevokeCommand(t *testing.T) {
4141
clientsMock.AuthInterface.On("RevokeToken", mock.Anything, "xoxp-example-1234").Return(nil)
4242
},
4343
ExpectedOutputs: []string{"Authorization successfully revoked"},
44-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
44+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
4545
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, "xoxp-example-1234")
4646
},
4747
},
@@ -53,7 +53,7 @@ func TestRevokeCommand(t *testing.T) {
5353
})).Return(iostreams.PasswordPromptResponse{}, slackerror.New(slackerror.ErrMissingFlag))
5454
},
5555
ExpectedErrorStrings: []string{"Failed to collect a token to revoke", "no_token_found", "missing_flag"},
56-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
56+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
5757
clients.AuthInterface.AssertNotCalled(t, "RevokeToken")
5858
},
5959
},
@@ -69,7 +69,7 @@ func TestRevokeCommand(t *testing.T) {
6969
clientsMock.AuthInterface.On("RevokeToken", mock.Anything, "xoxp-example-1234").Return(nil)
7070
},
7171
ExpectedOutputs: []string{"Authorization successfully revoked"},
72-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
72+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
7373
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, "xoxp-example-1234")
7474
},
7575
},
@@ -85,7 +85,7 @@ func TestRevokeCommand(t *testing.T) {
8585
clientsMock.AuthInterface.On("RevokeToken", mock.Anything, "xoxp-example-1234").Return(slackerror.New(slackerror.ErrNotAuthed))
8686
},
8787
ExpectedError: slackerror.New(slackerror.ErrNotAuthed),
88-
ExpectedAsserts: func(t *testing.T, clients *shared.ClientsMock) {
88+
ExpectedAsserts: func(t *testing.T, ctx context.Context, clients *shared.ClientsMock) {
8989
clients.AuthInterface.AssertCalled(t, "RevokeToken", mock.Anything, "xoxp-example-1234")
9090
clients.IO.AssertNotCalled(t, "PrintTrace", mock.Anything, slacktrace.AuthRevokeSuccess)
9191
},

cmd/collaborators/add_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ func TestAddCommand(t *testing.T) {
3939
appSelectMock.On("TeamAppSelectPrompt").Return(prompts.SelectedApp{App: types.App{AppID: "A123"}, Auth: types.SlackAuth{}}, nil)
4040
// Set experiment flag
4141
cm.Config.ExperimentsFlag = append(cm.Config.ExperimentsFlag, "read-only-collaborators")
42-
cm.Config.LoadExperiments(context.Background(), cm.IO.PrintDebug)
42+
cm.Config.LoadExperiments(ctx, cm.IO.PrintDebug)
4343
// Mock API call
4444
cm.ApiInterface.On("AddCollaborator", mock.Anything, mock.Anything,
4545
"A123",
4646
types.SlackUser{ID: "U123", PermissionType: types.READER}).Return(nil)
4747
},
48-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
48+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
4949
cm.ApiInterface.AssertCalled(t, "AddCollaborator", mock.Anything, mock.Anything,
5050
"A123",
5151
types.SlackUser{ID: "U123", PermissionType: types.READER})
@@ -63,14 +63,14 @@ func TestAddCommand(t *testing.T) {
6363
appSelectMock.On("TeamAppSelectPrompt").Return(prompts.SelectedApp{App: types.App{AppID: "A123"}, Auth: types.SlackAuth{}}, nil)
6464
// Set experiment flag
6565
cm.Config.ExperimentsFlag = append(cm.Config.ExperimentsFlag, "read-only-collaborators")
66-
cm.Config.LoadExperiments(context.Background(), cm.IO.PrintDebug)
66+
cm.Config.LoadExperiments(ctx, cm.IO.PrintDebug)
6767
// Mock API call
6868
cm.ApiInterface.On("AddCollaborator", mock.Anything, mock.Anything,
6969
"A123",
7070
types.SlackUser{Email: "[email protected]", PermissionType: types.OWNER}).Return(nil)
7171
addFlags.permissionType = "owner"
7272
},
73-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
73+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
7474
cm.ApiInterface.AssertCalled(t, "AddCollaborator", mock.Anything, mock.Anything,
7575
"A123",
7676
types.SlackUser{Email: "[email protected]", PermissionType: types.OWNER})
@@ -90,7 +90,7 @@ func TestAddCommand(t *testing.T) {
9090
cm.ApiInterface.On("AddCollaborator", mock.Anything, mock.Anything, mock.Anything, mock.Anything).
9191
Return(nil)
9292
},
93-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
93+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
9494
cm.ApiInterface.AssertCalled(t, "AddCollaborator", mock.Anything, mock.Anything,
9595
"A123",
9696
types.SlackUser{Email: "[email protected]", PermissionType: types.OWNER})

cmd/collaborators/remove_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func TestRemoveCommand(t *testing.T) {
5959
cm.ApiInterface.On("RemoveCollaborator", mock.Anything, mock.Anything, mock.Anything, mock.Anything).
6060
Return(nil)
6161
},
62-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
62+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
6363
collaborator := types.SlackUser{
6464
ID: "USLACKBOT",
6565
}
@@ -83,7 +83,7 @@ func TestRemoveCommand(t *testing.T) {
8383
cm.IO.On("SelectPrompt", mock.Anything, "Remove a collaborator", mock.Anything, mock.Anything).
8484
Return(iostreams.SelectPromptResponse{Prompt: true, Index: 1}, nil)
8585
},
86-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
86+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
8787
cm.ApiInterface.AssertCalled(t, "RemoveCollaborator", mock.Anything, mock.Anything, "A001", mockCollaborators[1])
8888
cm.IO.AssertCalled(t, "PrintTrace", mock.Anything, slacktrace.CollaboratorRemoveSuccess, mock.Anything)
8989
cm.IO.AssertCalled(t, "PrintTrace", mock.Anything, slacktrace.CollaboratorRemoveCollaborator, []string{"[email protected]"})
@@ -106,7 +106,7 @@ func TestRemoveCommand(t *testing.T) {
106106
cm.IO.On("ConfirmPrompt", mock.Anything, "Are you sure you want to remove yourself?", mock.Anything, mock.Anything).
107107
Return(false, nil)
108108
},
109-
ExpectedAsserts: func(t *testing.T, cm *shared.ClientsMock) {
109+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
110110
cm.ApiInterface.AssertNotCalled(t, "RemoveCollaborator", mock.Anything, mock.Anything, mock.Anything, mock.Anything)
111111
},
112112
ExpectedError: slackerror.New(slackerror.ErrProcessInterrupted),

0 commit comments

Comments
 (0)