1// Code generated by mockery; DO NOT EDIT.
2// github.com/vektra/mockery
3// template: testify
4
5package mocks
6
7import (
8 "context"
9 "time"
10
11 "bnema.dev/ermite/internal/domain"
12 mock "github.com/stretchr/testify/mock"
13)
14
15// NewTokenStore creates a new instance of TokenStore. 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 NewTokenStore(t interface {
18 mock.TestingT
19 Cleanup(func())
20}) *TokenStore {
21 if helper, ok := t.(interface{ Helper() }); ok {
22 helper.Helper()
23 }
24
25 mock := &TokenStore{}
26 mock.Mock.Test(t)
27
28 t.Cleanup(func() {
29 if helper, ok := t.(interface{ Helper() }); ok {
30 helper.Helper()
31 }
32 mock.AssertExpectations(t)
33 })
34
35 return mock
36}
37
38// TokenStore is an autogenerated mock type for the TokenStore type
39type TokenStore struct {
40 mock.Mock
41}
42
43type TokenStore_Expecter struct {
44 mock *mock.Mock
45}
46
47func (_m *TokenStore) EXPECT() *TokenStore_Expecter {
48 return &TokenStore_Expecter{mock: &_m.Mock}
49}
50
51// Create provides a mock function for the type TokenStore
52func (_mock *TokenStore) Create(ctx context.Context, token domain.Token) error {
53 ret := _mock.Called(ctx, token)
54
55 if len(ret) == 0 {
56 panic("no return value specified for Create")
57 }
58
59 var r0 error
60 if returnFunc, ok := ret.Get(0).(func(context.Context, domain.Token) error); ok {
61 r0 = returnFunc(ctx, token)
62 } else {
63 r0 = ret.Error(0)
64 }
65 return r0
66}
67
68// TokenStore_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'
69type TokenStore_Create_Call struct {
70 *mock.Call
71}
72
73// Create is a helper method to define mock.On call
74// - ctx context.Context
75// - token domain.Token
76func (_e *TokenStore_Expecter) Create(ctx any, token any) *TokenStore_Create_Call {
77 return &TokenStore_Create_Call{Call: _e.mock.On("Create", ctx, token)}
78}
79
80func (_c *TokenStore_Create_Call) Run(run func(ctx context.Context, token domain.Token)) *TokenStore_Create_Call {
81 _c.Call.Run(func(args mock.Arguments) {
82 var arg0 context.Context
83 if args[0] != nil {
84 arg0 = args[0].(context.Context)
85 }
86 var arg1 domain.Token
87 if args[1] != nil {
88 arg1 = args[1].(domain.Token)
89 }
90 run(
91 arg0,
92 arg1,
93 )
94 })
95 return _c
96}
97
98func (_c *TokenStore_Create_Call) Return(err error) *TokenStore_Create_Call {
99 _c.Call.Return(err)
100 return _c
101}
102
103func (_c *TokenStore_Create_Call) RunAndReturn(run func(ctx context.Context, token domain.Token) error) *TokenStore_Create_Call {
104 _c.Call.Return(run)
105 return _c
106}
107
108// FindByHash provides a mock function for the type TokenStore
109func (_mock *TokenStore) FindByHash(ctx context.Context, hash domain.TokenHash) (domain.Token, error) {
110 ret := _mock.Called(ctx, hash)
111
112 if len(ret) == 0 {
113 panic("no return value specified for FindByHash")
114 }
115
116 var r0 domain.Token
117 var r1 error
118 if returnFunc, ok := ret.Get(0).(func(context.Context, domain.TokenHash) (domain.Token, error)); ok {
119 return returnFunc(ctx, hash)
120 }
121 if returnFunc, ok := ret.Get(0).(func(context.Context, domain.TokenHash) domain.Token); ok {
122 r0 = returnFunc(ctx, hash)
123 } else {
124 r0 = ret.Get(0).(domain.Token)
125 }
126 if returnFunc, ok := ret.Get(1).(func(context.Context, domain.TokenHash) error); ok {
127 r1 = returnFunc(ctx, hash)
128 } else {
129 r1 = ret.Error(1)
130 }
131 return r0, r1
132}
133
134// TokenStore_FindByHash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindByHash'
135type TokenStore_FindByHash_Call struct {
136 *mock.Call
137}
138
139// FindByHash is a helper method to define mock.On call
140// - ctx context.Context
141// - hash domain.TokenHash
142func (_e *TokenStore_Expecter) FindByHash(ctx any, hash any) *TokenStore_FindByHash_Call {
143 return &TokenStore_FindByHash_Call{Call: _e.mock.On("FindByHash", ctx, hash)}
144}
145
146func (_c *TokenStore_FindByHash_Call) Run(run func(ctx context.Context, hash domain.TokenHash)) *TokenStore_FindByHash_Call {
147 _c.Call.Run(func(args mock.Arguments) {
148 var arg0 context.Context
149 if args[0] != nil {
150 arg0 = args[0].(context.Context)
151 }
152 var arg1 domain.TokenHash
153 if args[1] != nil {
154 arg1 = args[1].(domain.TokenHash)
155 }
156 run(
157 arg0,
158 arg1,
159 )
160 })
161 return _c
162}
163
164func (_c *TokenStore_FindByHash_Call) Return(token domain.Token, err error) *TokenStore_FindByHash_Call {
165 _c.Call.Return(token, err)
166 return _c
167}
168
169func (_c *TokenStore_FindByHash_Call) RunAndReturn(run func(ctx context.Context, hash domain.TokenHash) (domain.Token, error)) *TokenStore_FindByHash_Call {
170 _c.Call.Return(run)
171 return _c
172}
173
174// Get provides a mock function for the type TokenStore
175func (_mock *TokenStore) Get(ctx context.Context, id string) (domain.Token, error) {
176 ret := _mock.Called(ctx, id)
177
178 if len(ret) == 0 {
179 panic("no return value specified for Get")
180 }
181
182 var r0 domain.Token
183 var r1 error
184 if returnFunc, ok := ret.Get(0).(func(context.Context, string) (domain.Token, error)); ok {
185 return returnFunc(ctx, id)
186 }
187 if returnFunc, ok := ret.Get(0).(func(context.Context, string) domain.Token); ok {
188 r0 = returnFunc(ctx, id)
189 } else {
190 r0 = ret.Get(0).(domain.Token)
191 }
192 if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
193 r1 = returnFunc(ctx, id)
194 } else {
195 r1 = ret.Error(1)
196 }
197 return r0, r1
198}
199
200// TokenStore_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
201type TokenStore_Get_Call struct {
202 *mock.Call
203}
204
205// Get is a helper method to define mock.On call
206// - ctx context.Context
207// - id string
208func (_e *TokenStore_Expecter) Get(ctx any, id any) *TokenStore_Get_Call {
209 return &TokenStore_Get_Call{Call: _e.mock.On("Get", ctx, id)}
210}
211
212func (_c *TokenStore_Get_Call) Run(run func(ctx context.Context, id string)) *TokenStore_Get_Call {
213 _c.Call.Run(func(args mock.Arguments) {
214 var arg0 context.Context
215 if args[0] != nil {
216 arg0 = args[0].(context.Context)
217 }
218 var arg1 string
219 if args[1] != nil {
220 arg1 = args[1].(string)
221 }
222 run(
223 arg0,
224 arg1,
225 )
226 })
227 return _c
228}
229
230func (_c *TokenStore_Get_Call) Return(token domain.Token, err error) *TokenStore_Get_Call {
231 _c.Call.Return(token, err)
232 return _c
233}
234
235func (_c *TokenStore_Get_Call) RunAndReturn(run func(ctx context.Context, id string) (domain.Token, error)) *TokenStore_Get_Call {
236 _c.Call.Return(run)
237 return _c
238}
239
240// List provides a mock function for the type TokenStore
241func (_mock *TokenStore) List(ctx context.Context) ([]domain.Token, error) {
242 ret := _mock.Called(ctx)
243
244 if len(ret) == 0 {
245 panic("no return value specified for List")
246 }
247
248 var r0 []domain.Token
249 var r1 error
250 if returnFunc, ok := ret.Get(0).(func(context.Context) ([]domain.Token, error)); ok {
251 return returnFunc(ctx)
252 }
253 if returnFunc, ok := ret.Get(0).(func(context.Context) []domain.Token); ok {
254 r0 = returnFunc(ctx)
255 } else {
256 if ret.Get(0) != nil {
257 r0 = ret.Get(0).([]domain.Token)
258 }
259 }
260 if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
261 r1 = returnFunc(ctx)
262 } else {
263 r1 = ret.Error(1)
264 }
265 return r0, r1
266}
267
268// TokenStore_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
269type TokenStore_List_Call struct {
270 *mock.Call
271}
272
273// List is a helper method to define mock.On call
274// - ctx context.Context
275func (_e *TokenStore_Expecter) List(ctx any) *TokenStore_List_Call {
276 return &TokenStore_List_Call{Call: _e.mock.On("List", ctx)}
277}
278
279func (_c *TokenStore_List_Call) Run(run func(ctx context.Context)) *TokenStore_List_Call {
280 _c.Call.Run(func(args mock.Arguments) {
281 var arg0 context.Context
282 if args[0] != nil {
283 arg0 = args[0].(context.Context)
284 }
285 run(
286 arg0,
287 )
288 })
289 return _c
290}
291
292func (_c *TokenStore_List_Call) Return(tokens []domain.Token, err error) *TokenStore_List_Call {
293 _c.Call.Return(tokens, err)
294 return _c
295}
296
297func (_c *TokenStore_List_Call) RunAndReturn(run func(ctx context.Context) ([]domain.Token, error)) *TokenStore_List_Call {
298 _c.Call.Return(run)
299 return _c
300}
301
302// Revoke provides a mock function for the type TokenStore
303func (_mock *TokenStore) Revoke(ctx context.Context, id string) error {
304 ret := _mock.Called(ctx, id)
305
306 if len(ret) == 0 {
307 panic("no return value specified for Revoke")
308 }
309
310 var r0 error
311 if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
312 r0 = returnFunc(ctx, id)
313 } else {
314 r0 = ret.Error(0)
315 }
316 return r0
317}
318
319// TokenStore_Revoke_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Revoke'
320type TokenStore_Revoke_Call struct {
321 *mock.Call
322}
323
324// Revoke is a helper method to define mock.On call
325// - ctx context.Context
326// - id string
327func (_e *TokenStore_Expecter) Revoke(ctx any, id any) *TokenStore_Revoke_Call {
328 return &TokenStore_Revoke_Call{Call: _e.mock.On("Revoke", ctx, id)}
329}
330
331func (_c *TokenStore_Revoke_Call) Run(run func(ctx context.Context, id string)) *TokenStore_Revoke_Call {
332 _c.Call.Run(func(args mock.Arguments) {
333 var arg0 context.Context
334 if args[0] != nil {
335 arg0 = args[0].(context.Context)
336 }
337 var arg1 string
338 if args[1] != nil {
339 arg1 = args[1].(string)
340 }
341 run(
342 arg0,
343 arg1,
344 )
345 })
346 return _c
347}
348
349func (_c *TokenStore_Revoke_Call) Return(err error) *TokenStore_Revoke_Call {
350 _c.Call.Return(err)
351 return _c
352}
353
354func (_c *TokenStore_Revoke_Call) RunAndReturn(run func(ctx context.Context, id string) error) *TokenStore_Revoke_Call {
355 _c.Call.Return(run)
356 return _c
357}
358
359// Touch provides a mock function for the type TokenStore
360func (_mock *TokenStore) Touch(ctx context.Context, id string, at time.Time) error {
361 ret := _mock.Called(ctx, id, at)
362
363 if len(ret) == 0 {
364 panic("no return value specified for Touch")
365 }
366
367 var r0 error
368 if returnFunc, ok := ret.Get(0).(func(context.Context, string, time.Time) error); ok {
369 r0 = returnFunc(ctx, id, at)
370 } else {
371 r0 = ret.Error(0)
372 }
373 return r0
374}
375
376// TokenStore_Touch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Touch'
377type TokenStore_Touch_Call struct {
378 *mock.Call
379}
380
381// Touch is a helper method to define mock.On call
382// - ctx context.Context
383// - id string
384// - at time.Time
385func (_e *TokenStore_Expecter) Touch(ctx any, id any, at any) *TokenStore_Touch_Call {
386 return &TokenStore_Touch_Call{Call: _e.mock.On("Touch", ctx, id, at)}
387}
388
389func (_c *TokenStore_Touch_Call) Run(run func(ctx context.Context, id string, at time.Time)) *TokenStore_Touch_Call {
390 _c.Call.Run(func(args mock.Arguments) {
391 var arg0 context.Context
392 if args[0] != nil {
393 arg0 = args[0].(context.Context)
394 }
395 var arg1 string
396 if args[1] != nil {
397 arg1 = args[1].(string)
398 }
399 var arg2 time.Time
400 if args[2] != nil {
401 arg2 = args[2].(time.Time)
402 }
403 run(
404 arg0,
405 arg1,
406 arg2,
407 )
408 })
409 return _c
410}
411
412func (_c *TokenStore_Touch_Call) Return(err error) *TokenStore_Touch_Call {
413 _c.Call.Return(err)
414 return _c
415}
416
417func (_c *TokenStore_Touch_Call) RunAndReturn(run func(ctx context.Context, id string, at time.Time) error) *TokenStore_Touch_Call {
418 _c.Call.Return(run)
419 return _c
420}