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// GenerateAccessToken provides a mock function for the type MockAuthService
43func (_mock *MockAuthService) GenerateAccessToken(ctx context.Context, subject string, scopes []string, expiry time.Duration) (string, error) {
44 ret := _mock.Called(ctx, subject, scopes, expiry)
45
46 if len(ret) == 0 {
47 panic("no return value specified for GenerateAccessToken")
48 }
49
50 var r0 string
51 var r1 error
52 if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string, time.Duration) (string, error)); ok {
53 return returnFunc(ctx, subject, scopes, expiry)
54 }
55 if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string, time.Duration) string); ok {
56 r0 = returnFunc(ctx, subject, scopes, expiry)
57 } else {
58 r0 = ret.Get(0).(string)
59 }
60 if returnFunc, ok := ret.Get(1).(func(context.Context, string, []string, time.Duration) error); ok {
61 r1 = returnFunc(ctx, subject, scopes, expiry)
62 } else {
63 r1 = ret.Error(1)
64 }
65 return r0, r1
66}
67
68// MockAuthService_GenerateAccessToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GenerateAccessToken'
69type MockAuthService_GenerateAccessToken_Call struct {
70 *mock.Call
71}
72
73// GenerateAccessToken is a helper method to define mock.On call
74// - ctx context.Context
75// - subject string
76// - scopes []string
77// - expiry time.Duration
78func (_e *MockAuthService_Expecter) GenerateAccessToken(ctx interface{}, subject interface{}, scopes interface{}, expiry interface{}) *MockAuthService_GenerateAccessToken_Call {
79 return &MockAuthService_GenerateAccessToken_Call{Call: _e.mock.On("GenerateAccessToken", ctx, subject, scopes, expiry)}
80}
81
82func (_c *MockAuthService_GenerateAccessToken_Call) Run(run func(ctx context.Context, subject string, scopes []string, expiry time.Duration)) *MockAuthService_GenerateAccessToken_Call {
83 _c.Call.Run(func(args mock.Arguments) {
84 var arg0 context.Context
85 if args[0] != nil {
86 arg0 = args[0].(context.Context)
87 }
88 var arg1 string
89 if args[1] != nil {
90 arg1 = args[1].(string)
91 }
92 var arg2 []string
93 if args[2] != nil {
94 arg2 = args[2].([]string)
95 }
96 var arg3 time.Duration
97 if args[3] != nil {
98 arg3 = args[3].(time.Duration)
99 }
100 run(
101 arg0,
102 arg1,
103 arg2,
104 arg3,
105 )
106 })
107 return _c
108}
109
110func (_c *MockAuthService_GenerateAccessToken_Call) Return(s string, err error) *MockAuthService_GenerateAccessToken_Call {
111 _c.Call.Return(s, err)
112 return _c
113}
114
115func (_c *MockAuthService_GenerateAccessToken_Call) RunAndReturn(run func(ctx context.Context, subject string, scopes []string, expiry time.Duration) (string, error)) *MockAuthService_GenerateAccessToken_Call {
116 _c.Call.Return(run)
117 return _c
118}
119
120// GeneratePasswordHash provides a mock function for the type MockAuthService
121func (_mock *MockAuthService) GeneratePasswordHash(password string) (string, error) {
122 ret := _mock.Called(password)
123
124 if len(ret) == 0 {
125 panic("no return value specified for GeneratePasswordHash")
126 }
127
128 var r0 string
129 var r1 error
130 if returnFunc, ok := ret.Get(0).(func(string) (string, error)); ok {
131 return returnFunc(password)
132 }
133 if returnFunc, ok := ret.Get(0).(func(string) string); ok {
134 r0 = returnFunc(password)
135 } else {
136 r0 = ret.Get(0).(string)
137 }
138 if returnFunc, ok := ret.Get(1).(func(string) error); ok {
139 r1 = returnFunc(password)
140 } else {
141 r1 = ret.Error(1)
142 }
143 return r0, r1
144}
145
146// MockAuthService_GeneratePasswordHash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GeneratePasswordHash'
147type MockAuthService_GeneratePasswordHash_Call struct {
148 *mock.Call
149}
150
151// GeneratePasswordHash is a helper method to define mock.On call
152// - password string
153func (_e *MockAuthService_Expecter) GeneratePasswordHash(password interface{}) *MockAuthService_GeneratePasswordHash_Call {
154 return &MockAuthService_GeneratePasswordHash_Call{Call: _e.mock.On("GeneratePasswordHash", password)}
155}
156
157func (_c *MockAuthService_GeneratePasswordHash_Call) Run(run func(password string)) *MockAuthService_GeneratePasswordHash_Call {
158 _c.Call.Run(func(args mock.Arguments) {
159 var arg0 string
160 if args[0] != nil {
161 arg0 = args[0].(string)
162 }
163 run(
164 arg0,
165 )
166 })
167 return _c
168}
169
170func (_c *MockAuthService_GeneratePasswordHash_Call) Return(s string, err error) *MockAuthService_GeneratePasswordHash_Call {
171 _c.Call.Return(s, err)
172 return _c
173}
174
175func (_c *MockAuthService_GeneratePasswordHash_Call) RunAndReturn(run func(password string) (string, error)) *MockAuthService_GeneratePasswordHash_Call {
176 _c.Call.Return(run)
177 return _c
178}
179
180// GenerateToken provides a mock function for the type MockAuthService
181func (_mock *MockAuthService) GenerateToken(ctx context.Context, subject string, scopes []string, expiry time.Duration) (string, error) {
182 ret := _mock.Called(ctx, subject, scopes, expiry)
183
184 if len(ret) == 0 {
185 panic("no return value specified for GenerateToken")
186 }
187
188 var r0 string
189 var r1 error
190 if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string, time.Duration) (string, error)); ok {
191 return returnFunc(ctx, subject, scopes, expiry)
192 }
193 if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string, time.Duration) string); ok {
194 r0 = returnFunc(ctx, subject, scopes, expiry)
195 } else {
196 r0 = ret.Get(0).(string)
197 }
198 if returnFunc, ok := ret.Get(1).(func(context.Context, string, []string, time.Duration) error); ok {
199 r1 = returnFunc(ctx, subject, scopes, expiry)
200 } else {
201 r1 = ret.Error(1)
202 }
203 return r0, r1
204}
205
206// MockAuthService_GenerateToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GenerateToken'
207type MockAuthService_GenerateToken_Call struct {
208 *mock.Call
209}
210
211// GenerateToken is a helper method to define mock.On call
212// - ctx context.Context
213// - subject string
214// - scopes []string
215// - expiry time.Duration
216func (_e *MockAuthService_Expecter) GenerateToken(ctx interface{}, subject interface{}, scopes interface{}, expiry interface{}) *MockAuthService_GenerateToken_Call {
217 return &MockAuthService_GenerateToken_Call{Call: _e.mock.On("GenerateToken", ctx, subject, scopes, expiry)}
218}
219
220func (_c *MockAuthService_GenerateToken_Call) Run(run func(ctx context.Context, subject string, scopes []string, expiry time.Duration)) *MockAuthService_GenerateToken_Call {
221 _c.Call.Run(func(args mock.Arguments) {
222 var arg0 context.Context
223 if args[0] != nil {
224 arg0 = args[0].(context.Context)
225 }
226 var arg1 string
227 if args[1] != nil {
228 arg1 = args[1].(string)
229 }
230 var arg2 []string
231 if args[2] != nil {
232 arg2 = args[2].([]string)
233 }
234 var arg3 time.Duration
235 if args[3] != nil {
236 arg3 = args[3].(time.Duration)
237 }
238 run(
239 arg0,
240 arg1,
241 arg2,
242 arg3,
243 )
244 })
245 return _c
246}
247
248func (_c *MockAuthService_GenerateToken_Call) Return(s string, err error) *MockAuthService_GenerateToken_Call {
249 _c.Call.Return(s, err)
250 return _c
251}
252
253func (_c *MockAuthService_GenerateToken_Call) RunAndReturn(run func(ctx context.Context, subject string, scopes []string, expiry time.Duration) (string, error)) *MockAuthService_GenerateToken_Call {
254 _c.Call.Return(run)
255 return _c
256}
257
258// GetAuthType provides a mock function for the type MockAuthService
259func (_mock *MockAuthService) GetAuthType() domain.AuthType {
260 ret := _mock.Called()
261
262 if len(ret) == 0 {
263 panic("no return value specified for GetAuthType")
264 }
265
266 var r0 domain.AuthType
267 if returnFunc, ok := ret.Get(0).(func() domain.AuthType); ok {
268 r0 = returnFunc()
269 } else {
270 r0 = ret.Get(0).(domain.AuthType)
271 }
272 return r0
273}
274
275// MockAuthService_GetAuthType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAuthType'
276type MockAuthService_GetAuthType_Call struct {
277 *mock.Call
278}
279
280// GetAuthType is a helper method to define mock.On call
281func (_e *MockAuthService_Expecter) GetAuthType() *MockAuthService_GetAuthType_Call {
282 return &MockAuthService_GetAuthType_Call{Call: _e.mock.On("GetAuthType")}
283}
284
285func (_c *MockAuthService_GetAuthType_Call) Run(run func()) *MockAuthService_GetAuthType_Call {
286 _c.Call.Run(func(args mock.Arguments) {
287 run()
288 })
289 return _c
290}
291
292func (_c *MockAuthService_GetAuthType_Call) Return(authType domain.AuthType) *MockAuthService_GetAuthType_Call {
293 _c.Call.Return(authType)
294 return _c
295}
296
297func (_c *MockAuthService_GetAuthType_Call) RunAndReturn(run func() domain.AuthType) *MockAuthService_GetAuthType_Call {
298 _c.Call.Return(run)
299 return _c
300}
301
302// IsEnabled provides a mock function for the type MockAuthService
303func (_mock *MockAuthService) IsEnabled() bool {
304 ret := _mock.Called()
305
306 if len(ret) == 0 {
307 panic("no return value specified for IsEnabled")
308 }
309
310 var r0 bool
311 if returnFunc, ok := ret.Get(0).(func() bool); ok {
312 r0 = returnFunc()
313 } else {
314 r0 = ret.Get(0).(bool)
315 }
316 return r0
317}
318
319// MockAuthService_IsEnabled_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsEnabled'
320type MockAuthService_IsEnabled_Call struct {
321 *mock.Call
322}
323
324// IsEnabled is a helper method to define mock.On call
325func (_e *MockAuthService_Expecter) IsEnabled() *MockAuthService_IsEnabled_Call {
326 return &MockAuthService_IsEnabled_Call{Call: _e.mock.On("IsEnabled")}
327}
328
329func (_c *MockAuthService_IsEnabled_Call) Run(run func()) *MockAuthService_IsEnabled_Call {
330 _c.Call.Run(func(args mock.Arguments) {
331 run()
332 })
333 return _c
334}
335
336func (_c *MockAuthService_IsEnabled_Call) Return(b bool) *MockAuthService_IsEnabled_Call {
337 _c.Call.Return(b)
338 return _c
339}
340
341func (_c *MockAuthService_IsEnabled_Call) RunAndReturn(run func() bool) *MockAuthService_IsEnabled_Call {
342 _c.Call.Return(run)
343 return _c
344}
345
346// ListTokens provides a mock function for the type MockAuthService
347func (_mock *MockAuthService) ListTokens(ctx context.Context) ([]domain.Token, error) {
348 ret := _mock.Called(ctx)
349
350 if len(ret) == 0 {
351 panic("no return value specified for ListTokens")
352 }
353
354 var r0 []domain.Token
355 var r1 error
356 if returnFunc, ok := ret.Get(0).(func(context.Context) ([]domain.Token, error)); ok {
357 return returnFunc(ctx)
358 }
359 if returnFunc, ok := ret.Get(0).(func(context.Context) []domain.Token); ok {
360 r0 = returnFunc(ctx)
361 } else {
362 if ret.Get(0) != nil {
363 r0 = ret.Get(0).([]domain.Token)
364 }
365 }
366 if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
367 r1 = returnFunc(ctx)
368 } else {
369 r1 = ret.Error(1)
370 }
371 return r0, r1
372}
373
374// MockAuthService_ListTokens_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTokens'
375type MockAuthService_ListTokens_Call struct {
376 *mock.Call
377}
378
379// ListTokens is a helper method to define mock.On call
380// - ctx context.Context
381func (_e *MockAuthService_Expecter) ListTokens(ctx interface{}) *MockAuthService_ListTokens_Call {
382 return &MockAuthService_ListTokens_Call{Call: _e.mock.On("ListTokens", ctx)}
383}
384
385func (_c *MockAuthService_ListTokens_Call) Run(run func(ctx context.Context)) *MockAuthService_ListTokens_Call {
386 _c.Call.Run(func(args mock.Arguments) {
387 var arg0 context.Context
388 if args[0] != nil {
389 arg0 = args[0].(context.Context)
390 }
391 run(
392 arg0,
393 )
394 })
395 return _c
396}
397
398func (_c *MockAuthService_ListTokens_Call) Return(tokens []domain.Token, err error) *MockAuthService_ListTokens_Call {
399 _c.Call.Return(tokens, err)
400 return _c
401}
402
403func (_c *MockAuthService_ListTokens_Call) RunAndReturn(run func(ctx context.Context) ([]domain.Token, error)) *MockAuthService_ListTokens_Call {
404 _c.Call.Return(run)
405 return _c
406}
407
408// RevokeAllTokens provides a mock function for the type MockAuthService
409func (_mock *MockAuthService) RevokeAllTokens(ctx context.Context) (int, error) {
410 ret := _mock.Called(ctx)
411
412 if len(ret) == 0 {
413 panic("no return value specified for RevokeAllTokens")
414 }
415
416 var r0 int
417 var r1 error
418 if returnFunc, ok := ret.Get(0).(func(context.Context) (int, error)); ok {
419 return returnFunc(ctx)
420 }
421 if returnFunc, ok := ret.Get(0).(func(context.Context) int); ok {
422 r0 = returnFunc(ctx)
423 } else {
424 r0 = ret.Get(0).(int)
425 }
426 if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
427 r1 = returnFunc(ctx)
428 } else {
429 r1 = ret.Error(1)
430 }
431 return r0, r1
432}
433
434// MockAuthService_RevokeAllTokens_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RevokeAllTokens'
435type MockAuthService_RevokeAllTokens_Call struct {
436 *mock.Call
437}
438
439// RevokeAllTokens is a helper method to define mock.On call
440// - ctx context.Context
441func (_e *MockAuthService_Expecter) RevokeAllTokens(ctx interface{}) *MockAuthService_RevokeAllTokens_Call {
442 return &MockAuthService_RevokeAllTokens_Call{Call: _e.mock.On("RevokeAllTokens", ctx)}
443}
444
445func (_c *MockAuthService_RevokeAllTokens_Call) Run(run func(ctx context.Context)) *MockAuthService_RevokeAllTokens_Call {
446 _c.Call.Run(func(args mock.Arguments) {
447 var arg0 context.Context
448 if args[0] != nil {
449 arg0 = args[0].(context.Context)
450 }
451 run(
452 arg0,
453 )
454 })
455 return _c
456}
457
458func (_c *MockAuthService_RevokeAllTokens_Call) Return(n int, err error) *MockAuthService_RevokeAllTokens_Call {
459 _c.Call.Return(n, err)
460 return _c
461}
462
463func (_c *MockAuthService_RevokeAllTokens_Call) RunAndReturn(run func(ctx context.Context) (int, error)) *MockAuthService_RevokeAllTokens_Call {
464 _c.Call.Return(run)
465 return _c
466}
467
468// RevokeToken provides a mock function for the type MockAuthService
469func (_mock *MockAuthService) RevokeToken(ctx context.Context, tokenID string) error {
470 ret := _mock.Called(ctx, tokenID)
471
472 if len(ret) == 0 {
473 panic("no return value specified for RevokeToken")
474 }
475
476 var r0 error
477 if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
478 r0 = returnFunc(ctx, tokenID)
479 } else {
480 r0 = ret.Error(0)
481 }
482 return r0
483}
484
485// MockAuthService_RevokeToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RevokeToken'
486type MockAuthService_RevokeToken_Call struct {
487 *mock.Call
488}
489
490// RevokeToken is a helper method to define mock.On call
491// - ctx context.Context
492// - tokenID string
493func (_e *MockAuthService_Expecter) RevokeToken(ctx interface{}, tokenID interface{}) *MockAuthService_RevokeToken_Call {
494 return &MockAuthService_RevokeToken_Call{Call: _e.mock.On("RevokeToken", ctx, tokenID)}
495}
496
497func (_c *MockAuthService_RevokeToken_Call) Run(run func(ctx context.Context, tokenID string)) *MockAuthService_RevokeToken_Call {
498 _c.Call.Run(func(args mock.Arguments) {
499 var arg0 context.Context
500 if args[0] != nil {
501 arg0 = args[0].(context.Context)
502 }
503 var arg1 string
504 if args[1] != nil {
505 arg1 = args[1].(string)
506 }
507 run(
508 arg0,
509 arg1,
510 )
511 })
512 return _c
513}
514
515func (_c *MockAuthService_RevokeToken_Call) Return(err error) *MockAuthService_RevokeToken_Call {
516 _c.Call.Return(err)
517 return _c
518}
519
520func (_c *MockAuthService_RevokeToken_Call) RunAndReturn(run func(ctx context.Context, tokenID string) error) *MockAuthService_RevokeToken_Call {
521 _c.Call.Return(run)
522 return _c
523}
524
525// ValidatePassword provides a mock function for the type MockAuthService
526func (_mock *MockAuthService) ValidatePassword(ctx context.Context, username string, password string) bool {
527 ret := _mock.Called(ctx, username, password)
528
529 if len(ret) == 0 {
530 panic("no return value specified for ValidatePassword")
531 }
532
533 var r0 bool
534 if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) bool); ok {
535 r0 = returnFunc(ctx, username, password)
536 } else {
537 r0 = ret.Get(0).(bool)
538 }
539 return r0
540}
541
542// MockAuthService_ValidatePassword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidatePassword'
543type MockAuthService_ValidatePassword_Call struct {
544 *mock.Call
545}
546
547// ValidatePassword is a helper method to define mock.On call
548// - ctx context.Context
549// - username string
550// - password string
551func (_e *MockAuthService_Expecter) ValidatePassword(ctx interface{}, username interface{}, password interface{}) *MockAuthService_ValidatePassword_Call {
552 return &MockAuthService_ValidatePassword_Call{Call: _e.mock.On("ValidatePassword", ctx, username, password)}
553}
554
555func (_c *MockAuthService_ValidatePassword_Call) Run(run func(ctx context.Context, username string, password string)) *MockAuthService_ValidatePassword_Call {
556 _c.Call.Run(func(args mock.Arguments) {
557 var arg0 context.Context
558 if args[0] != nil {
559 arg0 = args[0].(context.Context)
560 }
561 var arg1 string
562 if args[1] != nil {
563 arg1 = args[1].(string)
564 }
565 var arg2 string
566 if args[2] != nil {
567 arg2 = args[2].(string)
568 }
569 run(
570 arg0,
571 arg1,
572 arg2,
573 )
574 })
575 return _c
576}
577
578func (_c *MockAuthService_ValidatePassword_Call) Return(b bool) *MockAuthService_ValidatePassword_Call {
579 _c.Call.Return(b)
580 return _c
581}
582
583func (_c *MockAuthService_ValidatePassword_Call) RunAndReturn(run func(ctx context.Context, username string, password string) bool) *MockAuthService_ValidatePassword_Call {
584 _c.Call.Return(run)
585 return _c
586}
587
588// ValidateToken provides a mock function for the type MockAuthService
589func (_mock *MockAuthService) ValidateToken(ctx context.Context, tokenString string) (*domain.TokenClaims, error) {
590 ret := _mock.Called(ctx, tokenString)
591
592 if len(ret) == 0 {
593 panic("no return value specified for ValidateToken")
594 }
595
596 var r0 *domain.TokenClaims
597 var r1 error
598 if returnFunc, ok := ret.Get(0).(func(context.Context, string) (*domain.TokenClaims, error)); ok {
599 return returnFunc(ctx, tokenString)
600 }
601 if returnFunc, ok := ret.Get(0).(func(context.Context, string) *domain.TokenClaims); ok {
602 r0 = returnFunc(ctx, tokenString)
603 } else {
604 if ret.Get(0) != nil {
605 r0 = ret.Get(0).(*domain.TokenClaims)
606 }
607 }
608 if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
609 r1 = returnFunc(ctx, tokenString)
610 } else {
611 r1 = ret.Error(1)
612 }
613 return r0, r1
614}
615
616// MockAuthService_ValidateToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidateToken'
617type MockAuthService_ValidateToken_Call struct {
618 *mock.Call
619}
620
621// ValidateToken is a helper method to define mock.On call
622// - ctx context.Context
623// - tokenString string
624func (_e *MockAuthService_Expecter) ValidateToken(ctx interface{}, tokenString interface{}) *MockAuthService_ValidateToken_Call {
625 return &MockAuthService_ValidateToken_Call{Call: _e.mock.On("ValidateToken", ctx, tokenString)}
626}
627
628func (_c *MockAuthService_ValidateToken_Call) Run(run func(ctx context.Context, tokenString string)) *MockAuthService_ValidateToken_Call {
629 _c.Call.Run(func(args mock.Arguments) {
630 var arg0 context.Context
631 if args[0] != nil {
632 arg0 = args[0].(context.Context)
633 }
634 var arg1 string
635 if args[1] != nil {
636 arg1 = args[1].(string)
637 }
638 run(
639 arg0,
640 arg1,
641 )
642 })
643 return _c
644}
645
646func (_c *MockAuthService_ValidateToken_Call) Return(tokenClaims *domain.TokenClaims, err error) *MockAuthService_ValidateToken_Call {
647 _c.Call.Return(tokenClaims, err)
648 return _c
649}
650
651func (_c *MockAuthService_ValidateToken_Call) RunAndReturn(run func(ctx context.Context, tokenString string) (*domain.TokenClaims, error)) *MockAuthService_ValidateToken_Call {
652 _c.Call.Return(run)
653 return _c
654}