v2.2.4 af396ea

mock_auth_service.go RawHistoryFolder

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// RevokeToken provides a mock function for the type MockAuthService
409func (_mock *MockAuthService) RevokeToken(ctx context.Context, tokenID string) error {
410	ret := _mock.Called(ctx, tokenID)
411
412	if len(ret) == 0 {
413		panic("no return value specified for RevokeToken")
414	}
415
416	var r0 error
417	if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
418		r0 = returnFunc(ctx, tokenID)
419	} else {
420		r0 = ret.Error(0)
421	}
422	return r0
423}
424
425// MockAuthService_RevokeToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RevokeToken'
426type MockAuthService_RevokeToken_Call struct {
427	*mock.Call
428}
429
430// RevokeToken is a helper method to define mock.On call
431//   - ctx context.Context
432//   - tokenID string
433func (_e *MockAuthService_Expecter) RevokeToken(ctx interface{}, tokenID interface{}) *MockAuthService_RevokeToken_Call {
434	return &MockAuthService_RevokeToken_Call{Call: _e.mock.On("RevokeToken", ctx, tokenID)}
435}
436
437func (_c *MockAuthService_RevokeToken_Call) Run(run func(ctx context.Context, tokenID string)) *MockAuthService_RevokeToken_Call {
438	_c.Call.Run(func(args mock.Arguments) {
439		var arg0 context.Context
440		if args[0] != nil {
441			arg0 = args[0].(context.Context)
442		}
443		var arg1 string
444		if args[1] != nil {
445			arg1 = args[1].(string)
446		}
447		run(
448			arg0,
449			arg1,
450		)
451	})
452	return _c
453}
454
455func (_c *MockAuthService_RevokeToken_Call) Return(err error) *MockAuthService_RevokeToken_Call {
456	_c.Call.Return(err)
457	return _c
458}
459
460func (_c *MockAuthService_RevokeToken_Call) RunAndReturn(run func(ctx context.Context, tokenID string) error) *MockAuthService_RevokeToken_Call {
461	_c.Call.Return(run)
462	return _c
463}
464
465// ValidatePassword provides a mock function for the type MockAuthService
466func (_mock *MockAuthService) ValidatePassword(ctx context.Context, username string, password string) bool {
467	ret := _mock.Called(ctx, username, password)
468
469	if len(ret) == 0 {
470		panic("no return value specified for ValidatePassword")
471	}
472
473	var r0 bool
474	if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) bool); ok {
475		r0 = returnFunc(ctx, username, password)
476	} else {
477		r0 = ret.Get(0).(bool)
478	}
479	return r0
480}
481
482// MockAuthService_ValidatePassword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidatePassword'
483type MockAuthService_ValidatePassword_Call struct {
484	*mock.Call
485}
486
487// ValidatePassword is a helper method to define mock.On call
488//   - ctx context.Context
489//   - username string
490//   - password string
491func (_e *MockAuthService_Expecter) ValidatePassword(ctx interface{}, username interface{}, password interface{}) *MockAuthService_ValidatePassword_Call {
492	return &MockAuthService_ValidatePassword_Call{Call: _e.mock.On("ValidatePassword", ctx, username, password)}
493}
494
495func (_c *MockAuthService_ValidatePassword_Call) Run(run func(ctx context.Context, username string, password string)) *MockAuthService_ValidatePassword_Call {
496	_c.Call.Run(func(args mock.Arguments) {
497		var arg0 context.Context
498		if args[0] != nil {
499			arg0 = args[0].(context.Context)
500		}
501		var arg1 string
502		if args[1] != nil {
503			arg1 = args[1].(string)
504		}
505		var arg2 string
506		if args[2] != nil {
507			arg2 = args[2].(string)
508		}
509		run(
510			arg0,
511			arg1,
512			arg2,
513		)
514	})
515	return _c
516}
517
518func (_c *MockAuthService_ValidatePassword_Call) Return(b bool) *MockAuthService_ValidatePassword_Call {
519	_c.Call.Return(b)
520	return _c
521}
522
523func (_c *MockAuthService_ValidatePassword_Call) RunAndReturn(run func(ctx context.Context, username string, password string) bool) *MockAuthService_ValidatePassword_Call {
524	_c.Call.Return(run)
525	return _c
526}
527
528// ValidateToken provides a mock function for the type MockAuthService
529func (_mock *MockAuthService) ValidateToken(ctx context.Context, tokenString string) (*domain.TokenClaims, error) {
530	ret := _mock.Called(ctx, tokenString)
531
532	if len(ret) == 0 {
533		panic("no return value specified for ValidateToken")
534	}
535
536	var r0 *domain.TokenClaims
537	var r1 error
538	if returnFunc, ok := ret.Get(0).(func(context.Context, string) (*domain.TokenClaims, error)); ok {
539		return returnFunc(ctx, tokenString)
540	}
541	if returnFunc, ok := ret.Get(0).(func(context.Context, string) *domain.TokenClaims); ok {
542		r0 = returnFunc(ctx, tokenString)
543	} else {
544		if ret.Get(0) != nil {
545			r0 = ret.Get(0).(*domain.TokenClaims)
546		}
547	}
548	if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
549		r1 = returnFunc(ctx, tokenString)
550	} else {
551		r1 = ret.Error(1)
552	}
553	return r0, r1
554}
555
556// MockAuthService_ValidateToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidateToken'
557type MockAuthService_ValidateToken_Call struct {
558	*mock.Call
559}
560
561// ValidateToken is a helper method to define mock.On call
562//   - ctx context.Context
563//   - tokenString string
564func (_e *MockAuthService_Expecter) ValidateToken(ctx interface{}, tokenString interface{}) *MockAuthService_ValidateToken_Call {
565	return &MockAuthService_ValidateToken_Call{Call: _e.mock.On("ValidateToken", ctx, tokenString)}
566}
567
568func (_c *MockAuthService_ValidateToken_Call) Run(run func(ctx context.Context, tokenString string)) *MockAuthService_ValidateToken_Call {
569	_c.Call.Run(func(args mock.Arguments) {
570		var arg0 context.Context
571		if args[0] != nil {
572			arg0 = args[0].(context.Context)
573		}
574		var arg1 string
575		if args[1] != nil {
576			arg1 = args[1].(string)
577		}
578		run(
579			arg0,
580			arg1,
581		)
582	})
583	return _c
584}
585
586func (_c *MockAuthService_ValidateToken_Call) Return(tokenClaims *domain.TokenClaims, err error) *MockAuthService_ValidateToken_Call {
587	_c.Call.Return(tokenClaims, err)
588	return _c
589}
590
591func (_c *MockAuthService_ValidateToken_Call) RunAndReturn(run func(ctx context.Context, tokenString string) (*domain.TokenClaims, error)) *MockAuthService_ValidateToken_Call {
592	_c.Call.Return(run)
593	return _c
594}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close