1// Code generated by mockery; DO NOT EDIT.
2// github.com/vektra/mockery
3// template: testify
4
5package mocks
6
7import (
8 "context"
9 "gordon/internal/domain"
10 "time"
11
12 mock "github.com/stretchr/testify/mock"
13)
14
15// NewMockAuthService creates a new instance of MockAuthService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
16// The first argument is typically a *testing.T value.
17func NewMockAuthService(t interface {
18 mock.TestingT
19 Cleanup(func())
20}) *MockAuthService {
21 mock := &MockAuthService{}
22 mock.Mock.Test(t)
23
24 t.Cleanup(func() { mock.AssertExpectations(t) })
25
26 return mock
27}
28
29// MockAuthService is an autogenerated mock type for the AuthService type
30type MockAuthService struct {
31 mock.Mock
32}
33
34type MockAuthService_Expecter struct {
35 mock *mock.Mock
36}
37
38func (_m *MockAuthService) EXPECT() *MockAuthService_Expecter {
39 return &MockAuthService_Expecter{mock: &_m.Mock}
40}
41
42// GeneratePasswordHash provides a mock function for the type MockAuthService
43func (_mock *MockAuthService) GeneratePasswordHash(password string) (string, error) {
44 ret := _mock.Called(password)
45
46 if len(ret) == 0 {
47 panic("no return value specified for GeneratePasswordHash")
48 }
49
50 var r0 string
51 var r1 error
52 if returnFunc, ok := ret.Get(0).(func(string) (string, error)); ok {
53 return returnFunc(password)
54 }
55 if returnFunc, ok := ret.Get(0).(func(string) string); ok {
56 r0 = returnFunc(password)
57 } else {
58 r0 = ret.Get(0).(string)
59 }
60 if returnFunc, ok := ret.Get(1).(func(string) error); ok {
61 r1 = returnFunc(password)
62 } else {
63 r1 = ret.Error(1)
64 }
65 return r0, r1
66}
67
68// MockAuthService_GeneratePasswordHash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GeneratePasswordHash'
69type MockAuthService_GeneratePasswordHash_Call struct {
70 *mock.Call
71}
72
73// GeneratePasswordHash is a helper method to define mock.On call
74// - password string
75func (_e *MockAuthService_Expecter) GeneratePasswordHash(password interface{}) *MockAuthService_GeneratePasswordHash_Call {
76 return &MockAuthService_GeneratePasswordHash_Call{Call: _e.mock.On("GeneratePasswordHash", password)}
77}
78
79func (_c *MockAuthService_GeneratePasswordHash_Call) Run(run func(password string)) *MockAuthService_GeneratePasswordHash_Call {
80 _c.Call.Run(func(args mock.Arguments) {
81 var arg0 string
82 if args[0] != nil {
83 arg0 = args[0].(string)
84 }
85 run(
86 arg0,
87 )
88 })
89 return _c
90}
91
92func (_c *MockAuthService_GeneratePasswordHash_Call) Return(s string, err error) *MockAuthService_GeneratePasswordHash_Call {
93 _c.Call.Return(s, err)
94 return _c
95}
96
97func (_c *MockAuthService_GeneratePasswordHash_Call) RunAndReturn(run func(password string) (string, error)) *MockAuthService_GeneratePasswordHash_Call {
98 _c.Call.Return(run)
99 return _c
100}
101
102// GenerateToken provides a mock function for the type MockAuthService
103func (_mock *MockAuthService) GenerateToken(ctx context.Context, subject string, scopes []string, expiry time.Duration) (string, error) {
104 ret := _mock.Called(ctx, subject, scopes, expiry)
105
106 if len(ret) == 0 {
107 panic("no return value specified for GenerateToken")
108 }
109
110 var r0 string
111 var r1 error
112 if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string, time.Duration) (string, error)); ok {
113 return returnFunc(ctx, subject, scopes, expiry)
114 }
115 if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string, time.Duration) string); ok {
116 r0 = returnFunc(ctx, subject, scopes, expiry)
117 } else {
118 r0 = ret.Get(0).(string)
119 }
120 if returnFunc, ok := ret.Get(1).(func(context.Context, string, []string, time.Duration) error); ok {
121 r1 = returnFunc(ctx, subject, scopes, expiry)
122 } else {
123 r1 = ret.Error(1)
124 }
125 return r0, r1
126}
127
128// MockAuthService_GenerateToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GenerateToken'
129type MockAuthService_GenerateToken_Call struct {
130 *mock.Call
131}
132
133// GenerateToken is a helper method to define mock.On call
134// - ctx context.Context
135// - subject string
136// - scopes []string
137// - expiry time.Duration
138func (_e *MockAuthService_Expecter) GenerateToken(ctx interface{}, subject interface{}, scopes interface{}, expiry interface{}) *MockAuthService_GenerateToken_Call {
139 return &MockAuthService_GenerateToken_Call{Call: _e.mock.On("GenerateToken", ctx, subject, scopes, expiry)}
140}
141
142func (_c *MockAuthService_GenerateToken_Call) Run(run func(ctx context.Context, subject string, scopes []string, expiry time.Duration)) *MockAuthService_GenerateToken_Call {
143 _c.Call.Run(func(args mock.Arguments) {
144 var arg0 context.Context
145 if args[0] != nil {
146 arg0 = args[0].(context.Context)
147 }
148 var arg1 string
149 if args[1] != nil {
150 arg1 = args[1].(string)
151 }
152 var arg2 []string
153 if args[2] != nil {
154 arg2 = args[2].([]string)
155 }
156 var arg3 time.Duration
157 if args[3] != nil {
158 arg3 = args[3].(time.Duration)
159 }
160 run(
161 arg0,
162 arg1,
163 arg2,
164 arg3,
165 )
166 })
167 return _c
168}
169
170func (_c *MockAuthService_GenerateToken_Call) Return(s string, err error) *MockAuthService_GenerateToken_Call {
171 _c.Call.Return(s, err)
172 return _c
173}
174
175func (_c *MockAuthService_GenerateToken_Call) RunAndReturn(run func(ctx context.Context, subject string, scopes []string, expiry time.Duration) (string, error)) *MockAuthService_GenerateToken_Call {
176 _c.Call.Return(run)
177 return _c
178}
179
180// GetAuthType provides a mock function for the type MockAuthService
181func (_mock *MockAuthService) GetAuthType() domain.AuthType {
182 ret := _mock.Called()
183
184 if len(ret) == 0 {
185 panic("no return value specified for GetAuthType")
186 }
187
188 var r0 domain.AuthType
189 if returnFunc, ok := ret.Get(0).(func() domain.AuthType); ok {
190 r0 = returnFunc()
191 } else {
192 r0 = ret.Get(0).(domain.AuthType)
193 }
194 return r0
195}
196
197// MockAuthService_GetAuthType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAuthType'
198type MockAuthService_GetAuthType_Call struct {
199 *mock.Call
200}
201
202// GetAuthType is a helper method to define mock.On call
203func (_e *MockAuthService_Expecter) GetAuthType() *MockAuthService_GetAuthType_Call {
204 return &MockAuthService_GetAuthType_Call{Call: _e.mock.On("GetAuthType")}
205}
206
207func (_c *MockAuthService_GetAuthType_Call) Run(run func()) *MockAuthService_GetAuthType_Call {
208 _c.Call.Run(func(args mock.Arguments) {
209 run()
210 })
211 return _c
212}
213
214func (_c *MockAuthService_GetAuthType_Call) Return(authType domain.AuthType) *MockAuthService_GetAuthType_Call {
215 _c.Call.Return(authType)
216 return _c
217}
218
219func (_c *MockAuthService_GetAuthType_Call) RunAndReturn(run func() domain.AuthType) *MockAuthService_GetAuthType_Call {
220 _c.Call.Return(run)
221 return _c
222}
223
224// IsEnabled provides a mock function for the type MockAuthService
225func (_mock *MockAuthService) IsEnabled() bool {
226 ret := _mock.Called()
227
228 if len(ret) == 0 {
229 panic("no return value specified for IsEnabled")
230 }
231
232 var r0 bool
233 if returnFunc, ok := ret.Get(0).(func() bool); ok {
234 r0 = returnFunc()
235 } else {
236 r0 = ret.Get(0).(bool)
237 }
238 return r0
239}
240
241// MockAuthService_IsEnabled_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsEnabled'
242type MockAuthService_IsEnabled_Call struct {
243 *mock.Call
244}
245
246// IsEnabled is a helper method to define mock.On call
247func (_e *MockAuthService_Expecter) IsEnabled() *MockAuthService_IsEnabled_Call {
248 return &MockAuthService_IsEnabled_Call{Call: _e.mock.On("IsEnabled")}
249}
250
251func (_c *MockAuthService_IsEnabled_Call) Run(run func()) *MockAuthService_IsEnabled_Call {
252 _c.Call.Run(func(args mock.Arguments) {
253 run()
254 })
255 return _c
256}
257
258func (_c *MockAuthService_IsEnabled_Call) Return(b bool) *MockAuthService_IsEnabled_Call {
259 _c.Call.Return(b)
260 return _c
261}
262
263func (_c *MockAuthService_IsEnabled_Call) RunAndReturn(run func() bool) *MockAuthService_IsEnabled_Call {
264 _c.Call.Return(run)
265 return _c
266}
267
268// ListTokens provides a mock function for the type MockAuthService
269func (_mock *MockAuthService) ListTokens(ctx context.Context) ([]domain.Token, error) {
270 ret := _mock.Called(ctx)
271
272 if len(ret) == 0 {
273 panic("no return value specified for ListTokens")
274 }
275
276 var r0 []domain.Token
277 var r1 error
278 if returnFunc, ok := ret.Get(0).(func(context.Context) ([]domain.Token, error)); ok {
279 return returnFunc(ctx)
280 }
281 if returnFunc, ok := ret.Get(0).(func(context.Context) []domain.Token); ok {
282 r0 = returnFunc(ctx)
283 } else {
284 if ret.Get(0) != nil {
285 r0 = ret.Get(0).([]domain.Token)
286 }
287 }
288 if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
289 r1 = returnFunc(ctx)
290 } else {
291 r1 = ret.Error(1)
292 }
293 return r0, r1
294}
295
296// MockAuthService_ListTokens_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTokens'
297type MockAuthService_ListTokens_Call struct {
298 *mock.Call
299}
300
301// ListTokens is a helper method to define mock.On call
302// - ctx context.Context
303func (_e *MockAuthService_Expecter) ListTokens(ctx interface{}) *MockAuthService_ListTokens_Call {
304 return &MockAuthService_ListTokens_Call{Call: _e.mock.On("ListTokens", ctx)}
305}
306
307func (_c *MockAuthService_ListTokens_Call) Run(run func(ctx context.Context)) *MockAuthService_ListTokens_Call {
308 _c.Call.Run(func(args mock.Arguments) {
309 var arg0 context.Context
310 if args[0] != nil {
311 arg0 = args[0].(context.Context)
312 }
313 run(
314 arg0,
315 )
316 })
317 return _c
318}
319
320func (_c *MockAuthService_ListTokens_Call) Return(tokens []domain.Token, err error) *MockAuthService_ListTokens_Call {
321 _c.Call.Return(tokens, err)
322 return _c
323}
324
325func (_c *MockAuthService_ListTokens_Call) RunAndReturn(run func(ctx context.Context) ([]domain.Token, error)) *MockAuthService_ListTokens_Call {
326 _c.Call.Return(run)
327 return _c
328}
329
330// RevokeToken provides a mock function for the type MockAuthService
331func (_mock *MockAuthService) RevokeToken(ctx context.Context, tokenID string) error {
332 ret := _mock.Called(ctx, tokenID)
333
334 if len(ret) == 0 {
335 panic("no return value specified for RevokeToken")
336 }
337
338 var r0 error
339 if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
340 r0 = returnFunc(ctx, tokenID)
341 } else {
342 r0 = ret.Error(0)
343 }
344 return r0
345}
346
347// MockAuthService_RevokeToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RevokeToken'
348type MockAuthService_RevokeToken_Call struct {
349 *mock.Call
350}
351
352// RevokeToken is a helper method to define mock.On call
353// - ctx context.Context
354// - tokenID string
355func (_e *MockAuthService_Expecter) RevokeToken(ctx interface{}, tokenID interface{}) *MockAuthService_RevokeToken_Call {
356 return &MockAuthService_RevokeToken_Call{Call: _e.mock.On("RevokeToken", ctx, tokenID)}
357}
358
359func (_c *MockAuthService_RevokeToken_Call) Run(run func(ctx context.Context, tokenID string)) *MockAuthService_RevokeToken_Call {
360 _c.Call.Run(func(args mock.Arguments) {
361 var arg0 context.Context
362 if args[0] != nil {
363 arg0 = args[0].(context.Context)
364 }
365 var arg1 string
366 if args[1] != nil {
367 arg1 = args[1].(string)
368 }
369 run(
370 arg0,
371 arg1,
372 )
373 })
374 return _c
375}
376
377func (_c *MockAuthService_RevokeToken_Call) Return(err error) *MockAuthService_RevokeToken_Call {
378 _c.Call.Return(err)
379 return _c
380}
381
382func (_c *MockAuthService_RevokeToken_Call) RunAndReturn(run func(ctx context.Context, tokenID string) error) *MockAuthService_RevokeToken_Call {
383 _c.Call.Return(run)
384 return _c
385}
386
387// ValidatePassword provides a mock function for the type MockAuthService
388func (_mock *MockAuthService) ValidatePassword(ctx context.Context, username string, password string) bool {
389 ret := _mock.Called(ctx, username, password)
390
391 if len(ret) == 0 {
392 panic("no return value specified for ValidatePassword")
393 }
394
395 var r0 bool
396 if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) bool); ok {
397 r0 = returnFunc(ctx, username, password)
398 } else {
399 r0 = ret.Get(0).(bool)
400 }
401 return r0
402}
403
404// MockAuthService_ValidatePassword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidatePassword'
405type MockAuthService_ValidatePassword_Call struct {
406 *mock.Call
407}
408
409// ValidatePassword is a helper method to define mock.On call
410// - ctx context.Context
411// - username string
412// - password string
413func (_e *MockAuthService_Expecter) ValidatePassword(ctx interface{}, username interface{}, password interface{}) *MockAuthService_ValidatePassword_Call {
414 return &MockAuthService_ValidatePassword_Call{Call: _e.mock.On("ValidatePassword", ctx, username, password)}
415}
416
417func (_c *MockAuthService_ValidatePassword_Call) Run(run func(ctx context.Context, username string, password string)) *MockAuthService_ValidatePassword_Call {
418 _c.Call.Run(func(args mock.Arguments) {
419 var arg0 context.Context
420 if args[0] != nil {
421 arg0 = args[0].(context.Context)
422 }
423 var arg1 string
424 if args[1] != nil {
425 arg1 = args[1].(string)
426 }
427 var arg2 string
428 if args[2] != nil {
429 arg2 = args[2].(string)
430 }
431 run(
432 arg0,
433 arg1,
434 arg2,
435 )
436 })
437 return _c
438}
439
440func (_c *MockAuthService_ValidatePassword_Call) Return(b bool) *MockAuthService_ValidatePassword_Call {
441 _c.Call.Return(b)
442 return _c
443}
444
445func (_c *MockAuthService_ValidatePassword_Call) RunAndReturn(run func(ctx context.Context, username string, password string) bool) *MockAuthService_ValidatePassword_Call {
446 _c.Call.Return(run)
447 return _c
448}
449
450// ValidateToken provides a mock function for the type MockAuthService
451func (_mock *MockAuthService) ValidateToken(ctx context.Context, tokenString string) (*domain.TokenClaims, error) {
452 ret := _mock.Called(ctx, tokenString)
453
454 if len(ret) == 0 {
455 panic("no return value specified for ValidateToken")
456 }
457
458 var r0 *domain.TokenClaims
459 var r1 error
460 if returnFunc, ok := ret.Get(0).(func(context.Context, string) (*domain.TokenClaims, error)); ok {
461 return returnFunc(ctx, tokenString)
462 }
463 if returnFunc, ok := ret.Get(0).(func(context.Context, string) *domain.TokenClaims); ok {
464 r0 = returnFunc(ctx, tokenString)
465 } else {
466 if ret.Get(0) != nil {
467 r0 = ret.Get(0).(*domain.TokenClaims)
468 }
469 }
470 if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
471 r1 = returnFunc(ctx, tokenString)
472 } else {
473 r1 = ret.Error(1)
474 }
475 return r0, r1
476}
477
478// MockAuthService_ValidateToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidateToken'
479type MockAuthService_ValidateToken_Call struct {
480 *mock.Call
481}
482
483// ValidateToken is a helper method to define mock.On call
484// - ctx context.Context
485// - tokenString string
486func (_e *MockAuthService_Expecter) ValidateToken(ctx interface{}, tokenString interface{}) *MockAuthService_ValidateToken_Call {
487 return &MockAuthService_ValidateToken_Call{Call: _e.mock.On("ValidateToken", ctx, tokenString)}
488}
489
490func (_c *MockAuthService_ValidateToken_Call) Run(run func(ctx context.Context, tokenString string)) *MockAuthService_ValidateToken_Call {
491 _c.Call.Run(func(args mock.Arguments) {
492 var arg0 context.Context
493 if args[0] != nil {
494 arg0 = args[0].(context.Context)
495 }
496 var arg1 string
497 if args[1] != nil {
498 arg1 = args[1].(string)
499 }
500 run(
501 arg0,
502 arg1,
503 )
504 })
505 return _c
506}
507
508func (_c *MockAuthService_ValidateToken_Call) Return(tokenClaims *domain.TokenClaims, err error) *MockAuthService_ValidateToken_Call {
509 _c.Call.Return(tokenClaims, err)
510 return _c
511}
512
513func (_c *MockAuthService_ValidateToken_Call) RunAndReturn(run func(ctx context.Context, tokenString string) (*domain.TokenClaims, error)) *MockAuthService_ValidateToken_Call {
514 _c.Call.Return(run)
515 return _c
516}