-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmocks_test.go
More file actions
634 lines (543 loc) · 17.9 KB
/
mocks_test.go
File metadata and controls
634 lines (543 loc) · 17.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
package main
import (
"context"
"github.com/rabbitmq/amqp091-go"
mock "github.com/stretchr/testify/mock"
)
// NewMockRestAPI creates a new instance of MockRestAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockRestAPI(t interface {
mock.TestingT
Cleanup(func())
}) *MockRestAPI {
mock := &MockRestAPI{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// MockRestAPI is an autogenerated mock type for the RestAPI type
type MockRestAPI struct {
mock.Mock
}
type MockRestAPI_Expecter struct {
mock *mock.Mock
}
func (_m *MockRestAPI) EXPECT() *MockRestAPI_Expecter {
return &MockRestAPI_Expecter{mock: &_m.Mock}
}
// SimulateProcessing provides a mock function for the type MockRestAPI
func (_mock *MockRestAPI) SimulateProcessing(queue *Queue) error {
ret := _mock.Called(queue)
if len(ret) == 0 {
panic("no return value specified for SimulateProcessing")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(*Queue) error); ok {
r0 = returnFunc(queue)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockRestAPI_SimulateProcessing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SimulateProcessing'
type MockRestAPI_SimulateProcessing_Call struct {
*mock.Call
}
// SimulateProcessing is a helper method to define mock.On call
// - queue *Queue
func (_e *MockRestAPI_Expecter) SimulateProcessing(queue interface{}) *MockRestAPI_SimulateProcessing_Call {
return &MockRestAPI_SimulateProcessing_Call{Call: _e.mock.On("SimulateProcessing", queue)}
}
func (_c *MockRestAPI_SimulateProcessing_Call) Run(run func(queue *Queue)) *MockRestAPI_SimulateProcessing_Call {
_c.Call.Run(func(args mock.Arguments) {
var arg0 *Queue
if args[0] != nil {
arg0 = args[0].(*Queue)
}
run(
arg0,
)
})
return _c
}
func (_c *MockRestAPI_SimulateProcessing_Call) Return(err error) *MockRestAPI_SimulateProcessing_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockRestAPI_SimulateProcessing_Call) RunAndReturn(run func(queue *Queue) error) *MockRestAPI_SimulateProcessing_Call {
_c.Call.Return(run)
return _c
}
// NewMockPublisher creates a new instance of MockPublisher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockPublisher(t interface {
mock.TestingT
Cleanup(func())
}) *MockPublisher {
mock := &MockPublisher{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// MockPublisher is an autogenerated mock type for the Publisher type
type MockPublisher struct {
mock.Mock
}
type MockPublisher_Expecter struct {
mock *mock.Mock
}
func (_m *MockPublisher) EXPECT() *MockPublisher_Expecter {
return &MockPublisher_Expecter{mock: &_m.Mock}
}
// Close provides a mock function for the type MockPublisher
func (_mock *MockPublisher) Close() error {
ret := _mock.Called()
if len(ret) == 0 {
panic("no return value specified for Close")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func() error); ok {
r0 = returnFunc()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPublisher_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
type MockPublisher_Close_Call struct {
*mock.Call
}
// Close is a helper method to define mock.On call
func (_e *MockPublisher_Expecter) Close() *MockPublisher_Close_Call {
return &MockPublisher_Close_Call{Call: _e.mock.On("Close")}
}
func (_c *MockPublisher_Close_Call) Run(run func()) *MockPublisher_Close_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockPublisher_Close_Call) Return(err error) *MockPublisher_Close_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockPublisher_Close_Call) RunAndReturn(run func() error) *MockPublisher_Close_Call {
_c.Call.Return(run)
return _c
}
// Consume provides a mock function for the type MockPublisher
func (_mock *MockPublisher) Consume(queue string, consumer string, autoAck bool, exclusive bool, noLocal bool, noWait bool, args amqp091.Table) (<-chan amqp091.Delivery, error) {
ret := _mock.Called(queue, consumer, autoAck, exclusive, noLocal, noWait, args)
if len(ret) == 0 {
panic("no return value specified for Consume")
}
var r0 <-chan amqp091.Delivery
var r1 error
if returnFunc, ok := ret.Get(0).(func(string, string, bool, bool, bool, bool, amqp091.Table) (<-chan amqp091.Delivery, error)); ok {
return returnFunc(queue, consumer, autoAck, exclusive, noLocal, noWait, args)
}
if returnFunc, ok := ret.Get(0).(func(string, string, bool, bool, bool, bool, amqp091.Table) <-chan amqp091.Delivery); ok {
r0 = returnFunc(queue, consumer, autoAck, exclusive, noLocal, noWait, args)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(<-chan amqp091.Delivery)
}
}
if returnFunc, ok := ret.Get(1).(func(string, string, bool, bool, bool, bool, amqp091.Table) error); ok {
r1 = returnFunc(queue, consumer, autoAck, exclusive, noLocal, noWait, args)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockPublisher_Consume_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Consume'
type MockPublisher_Consume_Call struct {
*mock.Call
}
// Consume is a helper method to define mock.On call
// - queue string
// - consumer string
// - autoAck bool
// - exclusive bool
// - noLocal bool
// - noWait bool
// - args amqp091.Table
func (_e *MockPublisher_Expecter) Consume(queue interface{}, consumer interface{}, autoAck interface{}, exclusive interface{}, noLocal interface{}, noWait interface{}, args interface{}) *MockPublisher_Consume_Call {
return &MockPublisher_Consume_Call{Call: _e.mock.On("Consume", queue, consumer, autoAck, exclusive, noLocal, noWait, args)}
}
func (_c *MockPublisher_Consume_Call) Run(run func(queue string, consumer string, autoAck bool, exclusive bool, noLocal bool, noWait bool, args amqp091.Table)) *MockPublisher_Consume_Call {
_c.Call.Run(func(args mock.Arguments) {
var arg0 string
if args[0] != nil {
arg0 = args[0].(string)
}
var arg1 string
if args[1] != nil {
arg1 = args[1].(string)
}
var arg2 bool
if args[2] != nil {
arg2 = args[2].(bool)
}
var arg3 bool
if args[3] != nil {
arg3 = args[3].(bool)
}
var arg4 bool
if args[4] != nil {
arg4 = args[4].(bool)
}
var arg5 bool
if args[5] != nil {
arg5 = args[5].(bool)
}
var arg6 amqp091.Table
if args[6] != nil {
arg6 = args[6].(amqp091.Table)
}
run(
arg0,
arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
)
})
return _c
}
func (_c *MockPublisher_Consume_Call) Return(deliveryCh <-chan amqp091.Delivery, err error) *MockPublisher_Consume_Call {
_c.Call.Return(deliveryCh, err)
return _c
}
func (_c *MockPublisher_Consume_Call) RunAndReturn(run func(queue string, consumer string, autoAck bool, exclusive bool, noLocal bool, noWait bool, args amqp091.Table) (<-chan amqp091.Delivery, error)) *MockPublisher_Consume_Call {
_c.Call.Return(run)
return _c
}
// PublishWithContext provides a mock function for the type MockPublisher
func (_mock *MockPublisher) PublishWithContext(ctx context.Context, exchange string, key string, mandatory bool, immediate bool, msg amqp091.Publishing) error {
ret := _mock.Called(ctx, exchange, key, mandatory, immediate, msg)
if len(ret) == 0 {
panic("no return value specified for PublishWithContext")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, bool, bool, amqp091.Publishing) error); ok {
r0 = returnFunc(ctx, exchange, key, mandatory, immediate, msg)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPublisher_PublishWithContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PublishWithContext'
type MockPublisher_PublishWithContext_Call struct {
*mock.Call
}
// PublishWithContext is a helper method to define mock.On call
// - ctx context.Context
// - exchange string
// - key string
// - mandatory bool
// - immediate bool
// - msg amqp091.Publishing
func (_e *MockPublisher_Expecter) PublishWithContext(ctx interface{}, exchange interface{}, key interface{}, mandatory interface{}, immediate interface{}, msg interface{}) *MockPublisher_PublishWithContext_Call {
return &MockPublisher_PublishWithContext_Call{Call: _e.mock.On("PublishWithContext", ctx, exchange, key, mandatory, immediate, msg)}
}
func (_c *MockPublisher_PublishWithContext_Call) Run(run func(ctx context.Context, exchange string, key string, mandatory bool, immediate bool, msg amqp091.Publishing)) *MockPublisher_PublishWithContext_Call {
_c.Call.Run(func(args mock.Arguments) {
var arg0 context.Context
if args[0] != nil {
arg0 = args[0].(context.Context)
}
var arg1 string
if args[1] != nil {
arg1 = args[1].(string)
}
var arg2 string
if args[2] != nil {
arg2 = args[2].(string)
}
var arg3 bool
if args[3] != nil {
arg3 = args[3].(bool)
}
var arg4 bool
if args[4] != nil {
arg4 = args[4].(bool)
}
var arg5 amqp091.Publishing
if args[5] != nil {
arg5 = args[5].(amqp091.Publishing)
}
run(
arg0,
arg1,
arg2,
arg3,
arg4,
arg5,
)
})
return _c
}
func (_c *MockPublisher_PublishWithContext_Call) Return(err error) *MockPublisher_PublishWithContext_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockPublisher_PublishWithContext_Call) RunAndReturn(run func(ctx context.Context, exchange string, key string, mandatory bool, immediate bool, msg amqp091.Publishing) error) *MockPublisher_PublishWithContext_Call {
_c.Call.Return(run)
return _c
}
// QueueDeclare provides a mock function for the type MockPublisher
func (_mock *MockPublisher) QueueDeclare(name string, durable bool, autoDelete bool, exclusive bool, noWait bool, args amqp091.Table) (amqp091.Queue, error) {
ret := _mock.Called(name, durable, autoDelete, exclusive, noWait, args)
if len(ret) == 0 {
panic("no return value specified for QueueDeclare")
}
var r0 amqp091.Queue
var r1 error
if returnFunc, ok := ret.Get(0).(func(string, bool, bool, bool, bool, amqp091.Table) (amqp091.Queue, error)); ok {
return returnFunc(name, durable, autoDelete, exclusive, noWait, args)
}
if returnFunc, ok := ret.Get(0).(func(string, bool, bool, bool, bool, amqp091.Table) amqp091.Queue); ok {
r0 = returnFunc(name, durable, autoDelete, exclusive, noWait, args)
} else {
r0 = ret.Get(0).(amqp091.Queue)
}
if returnFunc, ok := ret.Get(1).(func(string, bool, bool, bool, bool, amqp091.Table) error); ok {
r1 = returnFunc(name, durable, autoDelete, exclusive, noWait, args)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockPublisher_QueueDeclare_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'QueueDeclare'
type MockPublisher_QueueDeclare_Call struct {
*mock.Call
}
// QueueDeclare is a helper method to define mock.On call
// - name string
// - durable bool
// - autoDelete bool
// - exclusive bool
// - noWait bool
// - args amqp091.Table
func (_e *MockPublisher_Expecter) QueueDeclare(name interface{}, durable interface{}, autoDelete interface{}, exclusive interface{}, noWait interface{}, args interface{}) *MockPublisher_QueueDeclare_Call {
return &MockPublisher_QueueDeclare_Call{Call: _e.mock.On("QueueDeclare", name, durable, autoDelete, exclusive, noWait, args)}
}
func (_c *MockPublisher_QueueDeclare_Call) Run(run func(name string, durable bool, autoDelete bool, exclusive bool, noWait bool, args amqp091.Table)) *MockPublisher_QueueDeclare_Call {
_c.Call.Run(func(args mock.Arguments) {
var arg0 string
if args[0] != nil {
arg0 = args[0].(string)
}
var arg1 bool
if args[1] != nil {
arg1 = args[1].(bool)
}
var arg2 bool
if args[2] != nil {
arg2 = args[2].(bool)
}
var arg3 bool
if args[3] != nil {
arg3 = args[3].(bool)
}
var arg4 bool
if args[4] != nil {
arg4 = args[4].(bool)
}
var arg5 amqp091.Table
if args[5] != nil {
arg5 = args[5].(amqp091.Table)
}
run(
arg0,
arg1,
arg2,
arg3,
arg4,
arg5,
)
})
return _c
}
func (_c *MockPublisher_QueueDeclare_Call) Return(queue amqp091.Queue, err error) *MockPublisher_QueueDeclare_Call {
_c.Call.Return(queue, err)
return _c
}
func (_c *MockPublisher_QueueDeclare_Call) RunAndReturn(run func(name string, durable bool, autoDelete bool, exclusive bool, noWait bool, args amqp091.Table) (amqp091.Queue, error)) *MockPublisher_QueueDeclare_Call {
_c.Call.Return(run)
return _c
}
// NewMockCloser creates a new instance of MockCloser. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockCloser(t interface {
mock.TestingT
Cleanup(func())
}) *MockCloser {
mock := &MockCloser{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// MockCloser is an autogenerated mock type for the Closer type
type MockCloser struct {
mock.Mock
}
type MockCloser_Expecter struct {
mock *mock.Mock
}
func (_m *MockCloser) EXPECT() *MockCloser_Expecter {
return &MockCloser_Expecter{mock: &_m.Mock}
}
// Channel provides a mock function for the type MockCloser
func (_mock *MockCloser) Channel() (*amqp091.Channel, error) {
ret := _mock.Called()
if len(ret) == 0 {
panic("no return value specified for Channel")
}
var r0 *amqp091.Channel
var r1 error
if returnFunc, ok := ret.Get(0).(func() (*amqp091.Channel, error)); ok {
return returnFunc()
}
if returnFunc, ok := ret.Get(0).(func() *amqp091.Channel); ok {
r0 = returnFunc()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*amqp091.Channel)
}
}
if returnFunc, ok := ret.Get(1).(func() error); ok {
r1 = returnFunc()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCloser_Channel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Channel'
type MockCloser_Channel_Call struct {
*mock.Call
}
// Channel is a helper method to define mock.On call
func (_e *MockCloser_Expecter) Channel() *MockCloser_Channel_Call {
return &MockCloser_Channel_Call{Call: _e.mock.On("Channel")}
}
func (_c *MockCloser_Channel_Call) Run(run func()) *MockCloser_Channel_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockCloser_Channel_Call) Return(channel *amqp091.Channel, err error) *MockCloser_Channel_Call {
_c.Call.Return(channel, err)
return _c
}
func (_c *MockCloser_Channel_Call) RunAndReturn(run func() (*amqp091.Channel, error)) *MockCloser_Channel_Call {
_c.Call.Return(run)
return _c
}
// Close provides a mock function for the type MockCloser
func (_mock *MockCloser) Close() error {
ret := _mock.Called()
if len(ret) == 0 {
panic("no return value specified for Close")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func() error); ok {
r0 = returnFunc()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockCloser_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
type MockCloser_Close_Call struct {
*mock.Call
}
// Close is a helper method to define mock.On call
func (_e *MockCloser_Expecter) Close() *MockCloser_Close_Call {
return &MockCloser_Close_Call{Call: _e.mock.On("Close")}
}
func (_c *MockCloser_Close_Call) Run(run func()) *MockCloser_Close_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockCloser_Close_Call) Return(err error) *MockCloser_Close_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockCloser_Close_Call) RunAndReturn(run func() error) *MockCloser_Close_Call {
_c.Call.Return(run)
return _c
}
// NewMockQueueTrigger creates a new instance of MockQueueTrigger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockQueueTrigger(t interface {
mock.TestingT
Cleanup(func())
}) *MockQueueTrigger {
mock := &MockQueueTrigger{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// MockQueueTrigger is an autogenerated mock type for the QueueTrigger type
type MockQueueTrigger struct {
mock.Mock
}
type MockQueueTrigger_Expecter struct {
mock *mock.Mock
}
func (_m *MockQueueTrigger) EXPECT() *MockQueueTrigger_Expecter {
return &MockQueueTrigger_Expecter{mock: &_m.Mock}
}
// TriggerProcessing provides a mock function for the type MockQueueTrigger
func (_mock *MockQueueTrigger) TriggerProcessing(ctx context.Context) error {
ret := _mock.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for TriggerProcessing")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
r0 = returnFunc(ctx)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockQueueTrigger_TriggerProcessing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TriggerProcessing'
type MockQueueTrigger_TriggerProcessing_Call struct {
*mock.Call
}
// TriggerProcessing is a helper method to define mock.On call
// - ctx context.Context
func (_e *MockQueueTrigger_Expecter) TriggerProcessing(ctx interface{}) *MockQueueTrigger_TriggerProcessing_Call {
return &MockQueueTrigger_TriggerProcessing_Call{Call: _e.mock.On("TriggerProcessing", ctx)}
}
func (_c *MockQueueTrigger_TriggerProcessing_Call) Run(run func(ctx context.Context)) *MockQueueTrigger_TriggerProcessing_Call {
_c.Call.Run(func(args mock.Arguments) {
var arg0 context.Context
if args[0] != nil {
arg0 = args[0].(context.Context)
}
run(
arg0,
)
})
return _c
}
func (_c *MockQueueTrigger_TriggerProcessing_Call) Return(err error) *MockQueueTrigger_TriggerProcessing_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockQueueTrigger_TriggerProcessing_Call) RunAndReturn(run func(ctx context.Context) error) *MockQueueTrigger_TriggerProcessing_Call {
_c.Call.Return(run)
return _c
}