/
Controllers.go
390 lines (312 loc) · 12.4 KB
/
Controllers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
// Code generated by mockery v1.1.2. DO NOT EDIT.
package mocks
import (
common "github.com/mhogar/amber/common"
controllers "github.com/mhogar/amber/controllers"
mock "github.com/stretchr/testify/mock"
models "github.com/mhogar/amber/models"
uuid "github.com/google/uuid"
)
// Controllers is an autogenerated mock type for the Controllers type
type Controllers struct {
mock.Mock
}
// AuthenticateUserWithPassword provides a mock function with given fields: CRUD, username, password
func (_m *Controllers) AuthenticateUserWithPassword(CRUD controllers.AuthControllerCRUD, username string, password string) (*models.User, common.CustomError) {
ret := _m.Called(CRUD, username, password)
var r0 *models.User
if rf, ok := ret.Get(0).(func(controllers.AuthControllerCRUD, string, string) *models.User); ok {
r0 = rf(CRUD, username, password)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*models.User)
}
}
var r1 common.CustomError
if rf, ok := ret.Get(1).(func(controllers.AuthControllerCRUD, string, string) common.CustomError); ok {
r1 = rf(CRUD, username, password)
} else {
r1 = ret.Get(1).(common.CustomError)
}
return r0, r1
}
// CreateClient provides a mock function with given fields: CRUD, client
func (_m *Controllers) CreateClient(CRUD controllers.ClientControllerCRUD, client *models.Client) common.CustomError {
ret := _m.Called(CRUD, client)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.ClientControllerCRUD, *models.Client) common.CustomError); ok {
r0 = rf(CRUD, client)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// CreateSession provides a mock function with given fields: CRUD, username, password
func (_m *Controllers) CreateSession(CRUD controllers.SessionControllerCRUD, username string, password string) (*models.Session, common.CustomError) {
ret := _m.Called(CRUD, username, password)
var r0 *models.Session
if rf, ok := ret.Get(0).(func(controllers.SessionControllerCRUD, string, string) *models.Session); ok {
r0 = rf(CRUD, username, password)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*models.Session)
}
}
var r1 common.CustomError
if rf, ok := ret.Get(1).(func(controllers.SessionControllerCRUD, string, string) common.CustomError); ok {
r1 = rf(CRUD, username, password)
} else {
r1 = ret.Get(1).(common.CustomError)
}
return r0, r1
}
// CreateTokenRedirectURL provides a mock function with given fields: CRUD, clientId, username, password
func (_m *Controllers) CreateTokenRedirectURL(CRUD controllers.TokenControllerCRUD, clientId uuid.UUID, username string, password string) (string, common.CustomError) {
ret := _m.Called(CRUD, clientId, username, password)
var r0 string
if rf, ok := ret.Get(0).(func(controllers.TokenControllerCRUD, uuid.UUID, string, string) string); ok {
r0 = rf(CRUD, clientId, username, password)
} else {
r0 = ret.Get(0).(string)
}
var r1 common.CustomError
if rf, ok := ret.Get(1).(func(controllers.TokenControllerCRUD, uuid.UUID, string, string) common.CustomError); ok {
r1 = rf(CRUD, clientId, username, password)
} else {
r1 = ret.Get(1).(common.CustomError)
}
return r0, r1
}
// CreateUser provides a mock function with given fields: CRUD, username, password, rank
func (_m *Controllers) CreateUser(CRUD controllers.UserControllerCRUD, username string, password string, rank int) (*models.User, common.CustomError) {
ret := _m.Called(CRUD, username, password, rank)
var r0 *models.User
if rf, ok := ret.Get(0).(func(controllers.UserControllerCRUD, string, string, int) *models.User); ok {
r0 = rf(CRUD, username, password, rank)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*models.User)
}
}
var r1 common.CustomError
if rf, ok := ret.Get(1).(func(controllers.UserControllerCRUD, string, string, int) common.CustomError); ok {
r1 = rf(CRUD, username, password, rank)
} else {
r1 = ret.Get(1).(common.CustomError)
}
return r0, r1
}
// CreateUserRole provides a mock function with given fields: CRUD, role
func (_m *Controllers) CreateUserRole(CRUD controllers.UserRoleControllerCRUD, role *models.UserRole) common.CustomError {
ret := _m.Called(CRUD, role)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.UserRoleControllerCRUD, *models.UserRole) common.CustomError); ok {
r0 = rf(CRUD, role)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// DeleteAllOtherUserSessions provides a mock function with given fields: CRUD, username, id
func (_m *Controllers) DeleteAllOtherUserSessions(CRUD controllers.SessionControllerCRUD, username string, id uuid.UUID) common.CustomError {
ret := _m.Called(CRUD, username, id)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.SessionControllerCRUD, string, uuid.UUID) common.CustomError); ok {
r0 = rf(CRUD, username, id)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// DeleteAllUserSessions provides a mock function with given fields: CRUD, username
func (_m *Controllers) DeleteAllUserSessions(CRUD controllers.SessionControllerCRUD, username string) common.CustomError {
ret := _m.Called(CRUD, username)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.SessionControllerCRUD, string) common.CustomError); ok {
r0 = rf(CRUD, username)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// DeleteClient provides a mock function with given fields: CRUD, uid
func (_m *Controllers) DeleteClient(CRUD controllers.ClientControllerCRUD, uid uuid.UUID) common.CustomError {
ret := _m.Called(CRUD, uid)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.ClientControllerCRUD, uuid.UUID) common.CustomError); ok {
r0 = rf(CRUD, uid)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// DeleteSession provides a mock function with given fields: CRUD, id
func (_m *Controllers) DeleteSession(CRUD controllers.SessionControllerCRUD, id uuid.UUID) common.CustomError {
ret := _m.Called(CRUD, id)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.SessionControllerCRUD, uuid.UUID) common.CustomError); ok {
r0 = rf(CRUD, id)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// DeleteUser provides a mock function with given fields: CRUD, username
func (_m *Controllers) DeleteUser(CRUD controllers.UserControllerCRUD, username string) common.CustomError {
ret := _m.Called(CRUD, username)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.UserControllerCRUD, string) common.CustomError); ok {
r0 = rf(CRUD, username)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// DeleteUserRole provides a mock function with given fields: CRUD, clientUID, username
func (_m *Controllers) DeleteUserRole(CRUD controllers.UserRoleControllerCRUD, clientUID uuid.UUID, username string) common.CustomError {
ret := _m.Called(CRUD, clientUID, username)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.UserRoleControllerCRUD, uuid.UUID, string) common.CustomError); ok {
r0 = rf(CRUD, clientUID, username)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// GetClients provides a mock function with given fields: CRUD
func (_m *Controllers) GetClients(CRUD controllers.ClientControllerCRUD) ([]*models.Client, common.CustomError) {
ret := _m.Called(CRUD)
var r0 []*models.Client
if rf, ok := ret.Get(0).(func(controllers.ClientControllerCRUD) []*models.Client); ok {
r0 = rf(CRUD)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*models.Client)
}
}
var r1 common.CustomError
if rf, ok := ret.Get(1).(func(controllers.ClientControllerCRUD) common.CustomError); ok {
r1 = rf(CRUD)
} else {
r1 = ret.Get(1).(common.CustomError)
}
return r0, r1
}
// GetUserRolesWithLesserRankByClientUID provides a mock function with given fields: CRUD, clientUID, rank
func (_m *Controllers) GetUserRolesWithLesserRankByClientUID(CRUD controllers.UserRoleControllerCRUD, clientUID uuid.UUID, rank int) ([]*models.UserRole, common.CustomError) {
ret := _m.Called(CRUD, clientUID, rank)
var r0 []*models.UserRole
if rf, ok := ret.Get(0).(func(controllers.UserRoleControllerCRUD, uuid.UUID, int) []*models.UserRole); ok {
r0 = rf(CRUD, clientUID, rank)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*models.UserRole)
}
}
var r1 common.CustomError
if rf, ok := ret.Get(1).(func(controllers.UserRoleControllerCRUD, uuid.UUID, int) common.CustomError); ok {
r1 = rf(CRUD, clientUID, rank)
} else {
r1 = ret.Get(1).(common.CustomError)
}
return r0, r1
}
// GetUsersWithLesserRank provides a mock function with given fields: CRUD, rank
func (_m *Controllers) GetUsersWithLesserRank(CRUD controllers.UserControllerCRUD, rank int) ([]*models.User, common.CustomError) {
ret := _m.Called(CRUD, rank)
var r0 []*models.User
if rf, ok := ret.Get(0).(func(controllers.UserControllerCRUD, int) []*models.User); ok {
r0 = rf(CRUD, rank)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*models.User)
}
}
var r1 common.CustomError
if rf, ok := ret.Get(1).(func(controllers.UserControllerCRUD, int) common.CustomError); ok {
r1 = rf(CRUD, rank)
} else {
r1 = ret.Get(1).(common.CustomError)
}
return r0, r1
}
// UpdateClient provides a mock function with given fields: CRUD, client
func (_m *Controllers) UpdateClient(CRUD controllers.ClientControllerCRUD, client *models.Client) common.CustomError {
ret := _m.Called(CRUD, client)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.ClientControllerCRUD, *models.Client) common.CustomError); ok {
r0 = rf(CRUD, client)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// UpdateUser provides a mock function with given fields: CRUD, username, rank
func (_m *Controllers) UpdateUser(CRUD controllers.UserControllerCRUD, username string, rank int) (*models.User, common.CustomError) {
ret := _m.Called(CRUD, username, rank)
var r0 *models.User
if rf, ok := ret.Get(0).(func(controllers.UserControllerCRUD, string, int) *models.User); ok {
r0 = rf(CRUD, username, rank)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*models.User)
}
}
var r1 common.CustomError
if rf, ok := ret.Get(1).(func(controllers.UserControllerCRUD, string, int) common.CustomError); ok {
r1 = rf(CRUD, username, rank)
} else {
r1 = ret.Get(1).(common.CustomError)
}
return r0, r1
}
// UpdateUserPassword provides a mock function with given fields: CRUD, username, password
func (_m *Controllers) UpdateUserPassword(CRUD controllers.UserControllerCRUD, username string, password string) common.CustomError {
ret := _m.Called(CRUD, username, password)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.UserControllerCRUD, string, string) common.CustomError); ok {
r0 = rf(CRUD, username, password)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// UpdateUserPasswordWithAuth provides a mock function with given fields: CRUD, username, oldPassword, newPassword
func (_m *Controllers) UpdateUserPasswordWithAuth(CRUD controllers.UserControllerCRUD, username string, oldPassword string, newPassword string) common.CustomError {
ret := _m.Called(CRUD, username, oldPassword, newPassword)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.UserControllerCRUD, string, string, string) common.CustomError); ok {
r0 = rf(CRUD, username, oldPassword, newPassword)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// UpdateUserRole provides a mock function with given fields: CRUD, role
func (_m *Controllers) UpdateUserRole(CRUD controllers.UserRoleControllerCRUD, role *models.UserRole) common.CustomError {
ret := _m.Called(CRUD, role)
var r0 common.CustomError
if rf, ok := ret.Get(0).(func(controllers.UserRoleControllerCRUD, *models.UserRole) common.CustomError); ok {
r0 = rf(CRUD, role)
} else {
r0 = ret.Get(0).(common.CustomError)
}
return r0
}
// VerifyUserRank provides a mock function with given fields: CRUD, username, rank
func (_m *Controllers) VerifyUserRank(CRUD controllers.UserControllerCRUD, username string, rank int) (bool, common.CustomError) {
ret := _m.Called(CRUD, username, rank)
var r0 bool
if rf, ok := ret.Get(0).(func(controllers.UserControllerCRUD, string, int) bool); ok {
r0 = rf(CRUD, username, rank)
} else {
r0 = ret.Get(0).(bool)
}
var r1 common.CustomError
if rf, ok := ret.Get(1).(func(controllers.UserControllerCRUD, string, int) common.CustomError); ok {
r1 = rf(CRUD, username, rank)
} else {
r1 = ret.Get(1).(common.CustomError)
}
return r0, r1
}