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

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