@@ -55,7 +55,7 @@ func TestAdminAPIEndpoint(t *testing.T) {
55
55
t .Run ("When a server admin attempts to logout himself from all devices" , func (t * testing.T ) {
56
56
adminLogoutUserScenario (t , "Should not be allowed when calling POST on" ,
57
57
"/api/admin/users/1/logout" , "/api/admin/users/:id/logout" , func (sc * scenarioContext ) {
58
- bus .AddHandlerCtx ("test" , func (ctx context.Context , cmd * models.GetUserByIdQuery ) error {
58
+ bus .AddHandler ("test" , func (ctx context.Context , cmd * models.GetUserByIdQuery ) error {
59
59
cmd .Result = & models.User {Id : testUserID }
60
60
return nil
61
61
})
@@ -70,7 +70,7 @@ func TestAdminAPIEndpoint(t *testing.T) {
70
70
"/api/admin/users/:id/logout" , func (sc * scenarioContext ) {
71
71
userID := int64 (0 )
72
72
73
- bus .AddHandlerCtx ("test" , func (ctx context.Context , cmd * models.GetUserByIdQuery ) error {
73
+ bus .AddHandler ("test" , func (ctx context.Context , cmd * models.GetUserByIdQuery ) error {
74
74
userID = cmd .Id
75
75
return models .ErrUserNotFound
76
76
})
@@ -86,7 +86,7 @@ func TestAdminAPIEndpoint(t *testing.T) {
86
86
adminRevokeUserAuthTokenScenario (t , "Should return not found when calling POST on" ,
87
87
"/api/admin/users/200/revoke-auth-token" , "/api/admin/users/:id/revoke-auth-token" , cmd , func (sc * scenarioContext ) {
88
88
var userID int64
89
- bus .AddHandlerCtx ("test" , func (ctx context.Context , cmd * models.GetUserByIdQuery ) error {
89
+ bus .AddHandler ("test" , func (ctx context.Context , cmd * models.GetUserByIdQuery ) error {
90
90
userID = cmd .Id
91
91
return models .ErrUserNotFound
92
92
})
@@ -101,7 +101,7 @@ func TestAdminAPIEndpoint(t *testing.T) {
101
101
adminGetUserAuthTokensScenario (t , "Should return not found when calling GET on" ,
102
102
"/api/admin/users/200/auth-tokens" , "/api/admin/users/:id/auth-tokens" , func (sc * scenarioContext ) {
103
103
var userID int64
104
- bus .AddHandlerCtx ("test" , func (ctx context.Context , cmd * models.GetUserByIdQuery ) error {
104
+ bus .AddHandler ("test" , func (ctx context.Context , cmd * models.GetUserByIdQuery ) error {
105
105
userID = cmd .Id
106
106
return models .ErrUserNotFound
107
107
})
@@ -117,11 +117,11 @@ func TestAdminAPIEndpoint(t *testing.T) {
117
117
"/api/admin/users/42/enable" , "/api/admin/users/:id/enable" , func (sc * scenarioContext ) {
118
118
var userID int64
119
119
isDisabled := false
120
- bus .AddHandlerCtx ("test" , func (ctx context.Context , cmd * models.GetAuthInfoQuery ) error {
120
+ bus .AddHandler ("test" , func (ctx context.Context , cmd * models.GetAuthInfoQuery ) error {
121
121
return models .ErrUserNotFound
122
122
})
123
123
124
- bus .AddHandlerCtx ("test" , func (ctx context.Context , cmd * models.DisableUserCommand ) error {
124
+ bus .AddHandler ("test" , func (ctx context.Context , cmd * models.DisableUserCommand ) error {
125
125
userID = cmd .UserId
126
126
isDisabled = cmd .IsDisabled
127
127
return models .ErrUserNotFound
@@ -143,11 +143,11 @@ func TestAdminAPIEndpoint(t *testing.T) {
143
143
"/api/admin/users/42/disable" , "/api/admin/users/:id/disable" , func (sc * scenarioContext ) {
144
144
var userID int64
145
145
isDisabled := false
146
- bus .AddHandlerCtx ("test" , func (ctx context.Context , cmd * models.GetAuthInfoQuery ) error {
146
+ bus .AddHandler ("test" , func (ctx context.Context , cmd * models.GetAuthInfoQuery ) error {
147
147
return models .ErrUserNotFound
148
148
})
149
149
150
- bus .AddHandlerCtx ("test" , func (ctx context.Context , cmd * models.DisableUserCommand ) error {
150
+ bus .AddHandler ("test" , func (ctx context.Context , cmd * models.DisableUserCommand ) error {
151
151
userID = cmd .UserId
152
152
isDisabled = cmd .IsDisabled
153
153
return models .ErrUserNotFound
@@ -170,7 +170,7 @@ func TestAdminAPIEndpoint(t *testing.T) {
170
170
adminDisableUserScenario (t , "Should return Could not disable external user error" , "disable" ,
171
171
"/api/admin/users/42/disable" , "/api/admin/users/:id/disable" , func (sc * scenarioContext ) {
172
172
var userID int64
173
- bus .AddHandlerCtx ("test" , func (ctx context.Context , cmd * models.GetAuthInfoQuery ) error {
173
+ bus .AddHandler ("test" , func (ctx context.Context , cmd * models.GetAuthInfoQuery ) error {
174
174
userID = cmd .UserId
175
175
return nil
176
176
})
@@ -188,7 +188,7 @@ func TestAdminAPIEndpoint(t *testing.T) {
188
188
adminDisableUserScenario (t , "Should return Could not enable external user error" , "enable" ,
189
189
"/api/admin/users/42/enable" , "/api/admin/users/:id/enable" , func (sc * scenarioContext ) {
190
190
var userID int64
191
- bus .AddHandlerCtx ("test" , func (ctx context.Context , cmd * models.GetAuthInfoQuery ) error {
191
+ bus .AddHandler ("test" , func (ctx context.Context , cmd * models.GetAuthInfoQuery ) error {
192
192
userID = cmd .UserId
193
193
return nil
194
194
})
@@ -208,7 +208,7 @@ func TestAdminAPIEndpoint(t *testing.T) {
208
208
adminDeleteUserScenario (t , "Should return user not found error" , "/api/admin/users/42" ,
209
209
"/api/admin/users/:id" , func (sc * scenarioContext ) {
210
210
var userID int64
211
- bus .AddHandlerCtx ("test" , func (ctx context.Context , cmd * models.DeleteUserCommand ) error {
211
+ bus .AddHandler ("test" , func (ctx context.Context , cmd * models.DeleteUserCommand ) error {
212
212
userID = cmd .UserId
213
213
return models .ErrUserNotFound
214
214
})
0 commit comments