-
Notifications
You must be signed in to change notification settings - Fork 46
/
key_processor_mock.go
1804 lines (1488 loc) · 79.6 KB
/
key_processor_mock.go
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
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package testutils
// Code generated by http://github.com/gojuno/minimock (dev). DO NOT EDIT.
import (
"crypto"
"sync"
mm_atomic "sync/atomic"
mm_time "time"
"github.com/gojuno/minimock/v3"
)
// KeyProcessorMock implements insolar.KeyProcessor
type KeyProcessorMock struct {
t minimock.Tester
funcExportPrivateKeyPEM func(p1 crypto.PrivateKey) (ba1 []byte, err error)
inspectFuncExportPrivateKeyPEM func(p1 crypto.PrivateKey)
afterExportPrivateKeyPEMCounter uint64
beforeExportPrivateKeyPEMCounter uint64
ExportPrivateKeyPEMMock mKeyProcessorMockExportPrivateKeyPEM
funcExportPublicKeyBinary func(p1 crypto.PublicKey) (ba1 []byte, err error)
inspectFuncExportPublicKeyBinary func(p1 crypto.PublicKey)
afterExportPublicKeyBinaryCounter uint64
beforeExportPublicKeyBinaryCounter uint64
ExportPublicKeyBinaryMock mKeyProcessorMockExportPublicKeyBinary
funcExportPublicKeyPEM func(p1 crypto.PublicKey) (ba1 []byte, err error)
inspectFuncExportPublicKeyPEM func(p1 crypto.PublicKey)
afterExportPublicKeyPEMCounter uint64
beforeExportPublicKeyPEMCounter uint64
ExportPublicKeyPEMMock mKeyProcessorMockExportPublicKeyPEM
funcExtractPublicKey func(p1 crypto.PrivateKey) (p2 crypto.PublicKey)
inspectFuncExtractPublicKey func(p1 crypto.PrivateKey)
afterExtractPublicKeyCounter uint64
beforeExtractPublicKeyCounter uint64
ExtractPublicKeyMock mKeyProcessorMockExtractPublicKey
funcGeneratePrivateKey func() (p1 crypto.PrivateKey, err error)
inspectFuncGeneratePrivateKey func()
afterGeneratePrivateKeyCounter uint64
beforeGeneratePrivateKeyCounter uint64
GeneratePrivateKeyMock mKeyProcessorMockGeneratePrivateKey
funcImportPrivateKeyPEM func(ba1 []byte) (p1 crypto.PrivateKey, err error)
inspectFuncImportPrivateKeyPEM func(ba1 []byte)
afterImportPrivateKeyPEMCounter uint64
beforeImportPrivateKeyPEMCounter uint64
ImportPrivateKeyPEMMock mKeyProcessorMockImportPrivateKeyPEM
funcImportPublicKeyBinary func(ba1 []byte) (p1 crypto.PublicKey, err error)
inspectFuncImportPublicKeyBinary func(ba1 []byte)
afterImportPublicKeyBinaryCounter uint64
beforeImportPublicKeyBinaryCounter uint64
ImportPublicKeyBinaryMock mKeyProcessorMockImportPublicKeyBinary
funcImportPublicKeyPEM func(ba1 []byte) (p1 crypto.PublicKey, err error)
inspectFuncImportPublicKeyPEM func(ba1 []byte)
afterImportPublicKeyPEMCounter uint64
beforeImportPublicKeyPEMCounter uint64
ImportPublicKeyPEMMock mKeyProcessorMockImportPublicKeyPEM
}
// NewKeyProcessorMock returns a mock for insolar.KeyProcessor
func NewKeyProcessorMock(t minimock.Tester) *KeyProcessorMock {
m := &KeyProcessorMock{t: t}
if controller, ok := t.(minimock.MockController); ok {
controller.RegisterMocker(m)
}
m.ExportPrivateKeyPEMMock = mKeyProcessorMockExportPrivateKeyPEM{mock: m}
m.ExportPrivateKeyPEMMock.callArgs = []*KeyProcessorMockExportPrivateKeyPEMParams{}
m.ExportPublicKeyBinaryMock = mKeyProcessorMockExportPublicKeyBinary{mock: m}
m.ExportPublicKeyBinaryMock.callArgs = []*KeyProcessorMockExportPublicKeyBinaryParams{}
m.ExportPublicKeyPEMMock = mKeyProcessorMockExportPublicKeyPEM{mock: m}
m.ExportPublicKeyPEMMock.callArgs = []*KeyProcessorMockExportPublicKeyPEMParams{}
m.ExtractPublicKeyMock = mKeyProcessorMockExtractPublicKey{mock: m}
m.ExtractPublicKeyMock.callArgs = []*KeyProcessorMockExtractPublicKeyParams{}
m.GeneratePrivateKeyMock = mKeyProcessorMockGeneratePrivateKey{mock: m}
m.ImportPrivateKeyPEMMock = mKeyProcessorMockImportPrivateKeyPEM{mock: m}
m.ImportPrivateKeyPEMMock.callArgs = []*KeyProcessorMockImportPrivateKeyPEMParams{}
m.ImportPublicKeyBinaryMock = mKeyProcessorMockImportPublicKeyBinary{mock: m}
m.ImportPublicKeyBinaryMock.callArgs = []*KeyProcessorMockImportPublicKeyBinaryParams{}
m.ImportPublicKeyPEMMock = mKeyProcessorMockImportPublicKeyPEM{mock: m}
m.ImportPublicKeyPEMMock.callArgs = []*KeyProcessorMockImportPublicKeyPEMParams{}
return m
}
type mKeyProcessorMockExportPrivateKeyPEM struct {
mock *KeyProcessorMock
defaultExpectation *KeyProcessorMockExportPrivateKeyPEMExpectation
expectations []*KeyProcessorMockExportPrivateKeyPEMExpectation
callArgs []*KeyProcessorMockExportPrivateKeyPEMParams
mutex sync.RWMutex
}
// KeyProcessorMockExportPrivateKeyPEMExpectation specifies expectation struct of the KeyProcessor.ExportPrivateKeyPEM
type KeyProcessorMockExportPrivateKeyPEMExpectation struct {
mock *KeyProcessorMock
params *KeyProcessorMockExportPrivateKeyPEMParams
results *KeyProcessorMockExportPrivateKeyPEMResults
Counter uint64
}
// KeyProcessorMockExportPrivateKeyPEMParams contains parameters of the KeyProcessor.ExportPrivateKeyPEM
type KeyProcessorMockExportPrivateKeyPEMParams struct {
p1 crypto.PrivateKey
}
// KeyProcessorMockExportPrivateKeyPEMResults contains results of the KeyProcessor.ExportPrivateKeyPEM
type KeyProcessorMockExportPrivateKeyPEMResults struct {
ba1 []byte
err error
}
// Expect sets up expected params for KeyProcessor.ExportPrivateKeyPEM
func (mmExportPrivateKeyPEM *mKeyProcessorMockExportPrivateKeyPEM) Expect(p1 crypto.PrivateKey) *mKeyProcessorMockExportPrivateKeyPEM {
if mmExportPrivateKeyPEM.mock.funcExportPrivateKeyPEM != nil {
mmExportPrivateKeyPEM.mock.t.Fatalf("KeyProcessorMock.ExportPrivateKeyPEM mock is already set by Set")
}
if mmExportPrivateKeyPEM.defaultExpectation == nil {
mmExportPrivateKeyPEM.defaultExpectation = &KeyProcessorMockExportPrivateKeyPEMExpectation{}
}
mmExportPrivateKeyPEM.defaultExpectation.params = &KeyProcessorMockExportPrivateKeyPEMParams{p1}
for _, e := range mmExportPrivateKeyPEM.expectations {
if minimock.Equal(e.params, mmExportPrivateKeyPEM.defaultExpectation.params) {
mmExportPrivateKeyPEM.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmExportPrivateKeyPEM.defaultExpectation.params)
}
}
return mmExportPrivateKeyPEM
}
// Inspect accepts an inspector function that has same arguments as the KeyProcessor.ExportPrivateKeyPEM
func (mmExportPrivateKeyPEM *mKeyProcessorMockExportPrivateKeyPEM) Inspect(f func(p1 crypto.PrivateKey)) *mKeyProcessorMockExportPrivateKeyPEM {
if mmExportPrivateKeyPEM.mock.inspectFuncExportPrivateKeyPEM != nil {
mmExportPrivateKeyPEM.mock.t.Fatalf("Inspect function is already set for KeyProcessorMock.ExportPrivateKeyPEM")
}
mmExportPrivateKeyPEM.mock.inspectFuncExportPrivateKeyPEM = f
return mmExportPrivateKeyPEM
}
// Return sets up results that will be returned by KeyProcessor.ExportPrivateKeyPEM
func (mmExportPrivateKeyPEM *mKeyProcessorMockExportPrivateKeyPEM) Return(ba1 []byte, err error) *KeyProcessorMock {
if mmExportPrivateKeyPEM.mock.funcExportPrivateKeyPEM != nil {
mmExportPrivateKeyPEM.mock.t.Fatalf("KeyProcessorMock.ExportPrivateKeyPEM mock is already set by Set")
}
if mmExportPrivateKeyPEM.defaultExpectation == nil {
mmExportPrivateKeyPEM.defaultExpectation = &KeyProcessorMockExportPrivateKeyPEMExpectation{mock: mmExportPrivateKeyPEM.mock}
}
mmExportPrivateKeyPEM.defaultExpectation.results = &KeyProcessorMockExportPrivateKeyPEMResults{ba1, err}
return mmExportPrivateKeyPEM.mock
}
//Set uses given function f to mock the KeyProcessor.ExportPrivateKeyPEM method
func (mmExportPrivateKeyPEM *mKeyProcessorMockExportPrivateKeyPEM) Set(f func(p1 crypto.PrivateKey) (ba1 []byte, err error)) *KeyProcessorMock {
if mmExportPrivateKeyPEM.defaultExpectation != nil {
mmExportPrivateKeyPEM.mock.t.Fatalf("Default expectation is already set for the KeyProcessor.ExportPrivateKeyPEM method")
}
if len(mmExportPrivateKeyPEM.expectations) > 0 {
mmExportPrivateKeyPEM.mock.t.Fatalf("Some expectations are already set for the KeyProcessor.ExportPrivateKeyPEM method")
}
mmExportPrivateKeyPEM.mock.funcExportPrivateKeyPEM = f
return mmExportPrivateKeyPEM.mock
}
// When sets expectation for the KeyProcessor.ExportPrivateKeyPEM which will trigger the result defined by the following
// Then helper
func (mmExportPrivateKeyPEM *mKeyProcessorMockExportPrivateKeyPEM) When(p1 crypto.PrivateKey) *KeyProcessorMockExportPrivateKeyPEMExpectation {
if mmExportPrivateKeyPEM.mock.funcExportPrivateKeyPEM != nil {
mmExportPrivateKeyPEM.mock.t.Fatalf("KeyProcessorMock.ExportPrivateKeyPEM mock is already set by Set")
}
expectation := &KeyProcessorMockExportPrivateKeyPEMExpectation{
mock: mmExportPrivateKeyPEM.mock,
params: &KeyProcessorMockExportPrivateKeyPEMParams{p1},
}
mmExportPrivateKeyPEM.expectations = append(mmExportPrivateKeyPEM.expectations, expectation)
return expectation
}
// Then sets up KeyProcessor.ExportPrivateKeyPEM return parameters for the expectation previously defined by the When method
func (e *KeyProcessorMockExportPrivateKeyPEMExpectation) Then(ba1 []byte, err error) *KeyProcessorMock {
e.results = &KeyProcessorMockExportPrivateKeyPEMResults{ba1, err}
return e.mock
}
// ExportPrivateKeyPEM implements insolar.KeyProcessor
func (mmExportPrivateKeyPEM *KeyProcessorMock) ExportPrivateKeyPEM(p1 crypto.PrivateKey) (ba1 []byte, err error) {
mm_atomic.AddUint64(&mmExportPrivateKeyPEM.beforeExportPrivateKeyPEMCounter, 1)
defer mm_atomic.AddUint64(&mmExportPrivateKeyPEM.afterExportPrivateKeyPEMCounter, 1)
if mmExportPrivateKeyPEM.inspectFuncExportPrivateKeyPEM != nil {
mmExportPrivateKeyPEM.inspectFuncExportPrivateKeyPEM(p1)
}
mm_params := &KeyProcessorMockExportPrivateKeyPEMParams{p1}
// Record call args
mmExportPrivateKeyPEM.ExportPrivateKeyPEMMock.mutex.Lock()
mmExportPrivateKeyPEM.ExportPrivateKeyPEMMock.callArgs = append(mmExportPrivateKeyPEM.ExportPrivateKeyPEMMock.callArgs, mm_params)
mmExportPrivateKeyPEM.ExportPrivateKeyPEMMock.mutex.Unlock()
for _, e := range mmExportPrivateKeyPEM.ExportPrivateKeyPEMMock.expectations {
if minimock.Equal(e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.ba1, e.results.err
}
}
if mmExportPrivateKeyPEM.ExportPrivateKeyPEMMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmExportPrivateKeyPEM.ExportPrivateKeyPEMMock.defaultExpectation.Counter, 1)
mm_want := mmExportPrivateKeyPEM.ExportPrivateKeyPEMMock.defaultExpectation.params
mm_got := KeyProcessorMockExportPrivateKeyPEMParams{p1}
if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmExportPrivateKeyPEM.t.Errorf("KeyProcessorMock.ExportPrivateKeyPEM got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmExportPrivateKeyPEM.ExportPrivateKeyPEMMock.defaultExpectation.results
if mm_results == nil {
mmExportPrivateKeyPEM.t.Fatal("No results are set for the KeyProcessorMock.ExportPrivateKeyPEM")
}
return (*mm_results).ba1, (*mm_results).err
}
if mmExportPrivateKeyPEM.funcExportPrivateKeyPEM != nil {
return mmExportPrivateKeyPEM.funcExportPrivateKeyPEM(p1)
}
mmExportPrivateKeyPEM.t.Fatalf("Unexpected call to KeyProcessorMock.ExportPrivateKeyPEM. %v", p1)
return
}
// ExportPrivateKeyPEMAfterCounter returns a count of finished KeyProcessorMock.ExportPrivateKeyPEM invocations
func (mmExportPrivateKeyPEM *KeyProcessorMock) ExportPrivateKeyPEMAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmExportPrivateKeyPEM.afterExportPrivateKeyPEMCounter)
}
// ExportPrivateKeyPEMBeforeCounter returns a count of KeyProcessorMock.ExportPrivateKeyPEM invocations
func (mmExportPrivateKeyPEM *KeyProcessorMock) ExportPrivateKeyPEMBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmExportPrivateKeyPEM.beforeExportPrivateKeyPEMCounter)
}
// Calls returns a list of arguments used in each call to KeyProcessorMock.ExportPrivateKeyPEM.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmExportPrivateKeyPEM *mKeyProcessorMockExportPrivateKeyPEM) Calls() []*KeyProcessorMockExportPrivateKeyPEMParams {
mmExportPrivateKeyPEM.mutex.RLock()
argCopy := make([]*KeyProcessorMockExportPrivateKeyPEMParams, len(mmExportPrivateKeyPEM.callArgs))
copy(argCopy, mmExportPrivateKeyPEM.callArgs)
mmExportPrivateKeyPEM.mutex.RUnlock()
return argCopy
}
// MinimockExportPrivateKeyPEMDone returns true if the count of the ExportPrivateKeyPEM invocations corresponds
// the number of defined expectations
func (m *KeyProcessorMock) MinimockExportPrivateKeyPEMDone() bool {
for _, e := range m.ExportPrivateKeyPEMMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
// if default expectation was set then invocations count should be greater than zero
if m.ExportPrivateKeyPEMMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterExportPrivateKeyPEMCounter) < 1 {
return false
}
// if func was set then invocations count should be greater than zero
if m.funcExportPrivateKeyPEM != nil && mm_atomic.LoadUint64(&m.afterExportPrivateKeyPEMCounter) < 1 {
return false
}
return true
}
// MinimockExportPrivateKeyPEMInspect logs each unmet expectation
func (m *KeyProcessorMock) MinimockExportPrivateKeyPEMInspect() {
for _, e := range m.ExportPrivateKeyPEMMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to KeyProcessorMock.ExportPrivateKeyPEM with params: %#v", *e.params)
}
}
// if default expectation was set then invocations count should be greater than zero
if m.ExportPrivateKeyPEMMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterExportPrivateKeyPEMCounter) < 1 {
if m.ExportPrivateKeyPEMMock.defaultExpectation.params == nil {
m.t.Error("Expected call to KeyProcessorMock.ExportPrivateKeyPEM")
} else {
m.t.Errorf("Expected call to KeyProcessorMock.ExportPrivateKeyPEM with params: %#v", *m.ExportPrivateKeyPEMMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcExportPrivateKeyPEM != nil && mm_atomic.LoadUint64(&m.afterExportPrivateKeyPEMCounter) < 1 {
m.t.Error("Expected call to KeyProcessorMock.ExportPrivateKeyPEM")
}
}
type mKeyProcessorMockExportPublicKeyBinary struct {
mock *KeyProcessorMock
defaultExpectation *KeyProcessorMockExportPublicKeyBinaryExpectation
expectations []*KeyProcessorMockExportPublicKeyBinaryExpectation
callArgs []*KeyProcessorMockExportPublicKeyBinaryParams
mutex sync.RWMutex
}
// KeyProcessorMockExportPublicKeyBinaryExpectation specifies expectation struct of the KeyProcessor.ExportPublicKeyBinary
type KeyProcessorMockExportPublicKeyBinaryExpectation struct {
mock *KeyProcessorMock
params *KeyProcessorMockExportPublicKeyBinaryParams
results *KeyProcessorMockExportPublicKeyBinaryResults
Counter uint64
}
// KeyProcessorMockExportPublicKeyBinaryParams contains parameters of the KeyProcessor.ExportPublicKeyBinary
type KeyProcessorMockExportPublicKeyBinaryParams struct {
p1 crypto.PublicKey
}
// KeyProcessorMockExportPublicKeyBinaryResults contains results of the KeyProcessor.ExportPublicKeyBinary
type KeyProcessorMockExportPublicKeyBinaryResults struct {
ba1 []byte
err error
}
// Expect sets up expected params for KeyProcessor.ExportPublicKeyBinary
func (mmExportPublicKeyBinary *mKeyProcessorMockExportPublicKeyBinary) Expect(p1 crypto.PublicKey) *mKeyProcessorMockExportPublicKeyBinary {
if mmExportPublicKeyBinary.mock.funcExportPublicKeyBinary != nil {
mmExportPublicKeyBinary.mock.t.Fatalf("KeyProcessorMock.ExportPublicKeyBinary mock is already set by Set")
}
if mmExportPublicKeyBinary.defaultExpectation == nil {
mmExportPublicKeyBinary.defaultExpectation = &KeyProcessorMockExportPublicKeyBinaryExpectation{}
}
mmExportPublicKeyBinary.defaultExpectation.params = &KeyProcessorMockExportPublicKeyBinaryParams{p1}
for _, e := range mmExportPublicKeyBinary.expectations {
if minimock.Equal(e.params, mmExportPublicKeyBinary.defaultExpectation.params) {
mmExportPublicKeyBinary.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmExportPublicKeyBinary.defaultExpectation.params)
}
}
return mmExportPublicKeyBinary
}
// Inspect accepts an inspector function that has same arguments as the KeyProcessor.ExportPublicKeyBinary
func (mmExportPublicKeyBinary *mKeyProcessorMockExportPublicKeyBinary) Inspect(f func(p1 crypto.PublicKey)) *mKeyProcessorMockExportPublicKeyBinary {
if mmExportPublicKeyBinary.mock.inspectFuncExportPublicKeyBinary != nil {
mmExportPublicKeyBinary.mock.t.Fatalf("Inspect function is already set for KeyProcessorMock.ExportPublicKeyBinary")
}
mmExportPublicKeyBinary.mock.inspectFuncExportPublicKeyBinary = f
return mmExportPublicKeyBinary
}
// Return sets up results that will be returned by KeyProcessor.ExportPublicKeyBinary
func (mmExportPublicKeyBinary *mKeyProcessorMockExportPublicKeyBinary) Return(ba1 []byte, err error) *KeyProcessorMock {
if mmExportPublicKeyBinary.mock.funcExportPublicKeyBinary != nil {
mmExportPublicKeyBinary.mock.t.Fatalf("KeyProcessorMock.ExportPublicKeyBinary mock is already set by Set")
}
if mmExportPublicKeyBinary.defaultExpectation == nil {
mmExportPublicKeyBinary.defaultExpectation = &KeyProcessorMockExportPublicKeyBinaryExpectation{mock: mmExportPublicKeyBinary.mock}
}
mmExportPublicKeyBinary.defaultExpectation.results = &KeyProcessorMockExportPublicKeyBinaryResults{ba1, err}
return mmExportPublicKeyBinary.mock
}
//Set uses given function f to mock the KeyProcessor.ExportPublicKeyBinary method
func (mmExportPublicKeyBinary *mKeyProcessorMockExportPublicKeyBinary) Set(f func(p1 crypto.PublicKey) (ba1 []byte, err error)) *KeyProcessorMock {
if mmExportPublicKeyBinary.defaultExpectation != nil {
mmExportPublicKeyBinary.mock.t.Fatalf("Default expectation is already set for the KeyProcessor.ExportPublicKeyBinary method")
}
if len(mmExportPublicKeyBinary.expectations) > 0 {
mmExportPublicKeyBinary.mock.t.Fatalf("Some expectations are already set for the KeyProcessor.ExportPublicKeyBinary method")
}
mmExportPublicKeyBinary.mock.funcExportPublicKeyBinary = f
return mmExportPublicKeyBinary.mock
}
// When sets expectation for the KeyProcessor.ExportPublicKeyBinary which will trigger the result defined by the following
// Then helper
func (mmExportPublicKeyBinary *mKeyProcessorMockExportPublicKeyBinary) When(p1 crypto.PublicKey) *KeyProcessorMockExportPublicKeyBinaryExpectation {
if mmExportPublicKeyBinary.mock.funcExportPublicKeyBinary != nil {
mmExportPublicKeyBinary.mock.t.Fatalf("KeyProcessorMock.ExportPublicKeyBinary mock is already set by Set")
}
expectation := &KeyProcessorMockExportPublicKeyBinaryExpectation{
mock: mmExportPublicKeyBinary.mock,
params: &KeyProcessorMockExportPublicKeyBinaryParams{p1},
}
mmExportPublicKeyBinary.expectations = append(mmExportPublicKeyBinary.expectations, expectation)
return expectation
}
// Then sets up KeyProcessor.ExportPublicKeyBinary return parameters for the expectation previously defined by the When method
func (e *KeyProcessorMockExportPublicKeyBinaryExpectation) Then(ba1 []byte, err error) *KeyProcessorMock {
e.results = &KeyProcessorMockExportPublicKeyBinaryResults{ba1, err}
return e.mock
}
// ExportPublicKeyBinary implements insolar.KeyProcessor
func (mmExportPublicKeyBinary *KeyProcessorMock) ExportPublicKeyBinary(p1 crypto.PublicKey) (ba1 []byte, err error) {
mm_atomic.AddUint64(&mmExportPublicKeyBinary.beforeExportPublicKeyBinaryCounter, 1)
defer mm_atomic.AddUint64(&mmExportPublicKeyBinary.afterExportPublicKeyBinaryCounter, 1)
if mmExportPublicKeyBinary.inspectFuncExportPublicKeyBinary != nil {
mmExportPublicKeyBinary.inspectFuncExportPublicKeyBinary(p1)
}
mm_params := &KeyProcessorMockExportPublicKeyBinaryParams{p1}
// Record call args
mmExportPublicKeyBinary.ExportPublicKeyBinaryMock.mutex.Lock()
mmExportPublicKeyBinary.ExportPublicKeyBinaryMock.callArgs = append(mmExportPublicKeyBinary.ExportPublicKeyBinaryMock.callArgs, mm_params)
mmExportPublicKeyBinary.ExportPublicKeyBinaryMock.mutex.Unlock()
for _, e := range mmExportPublicKeyBinary.ExportPublicKeyBinaryMock.expectations {
if minimock.Equal(e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.ba1, e.results.err
}
}
if mmExportPublicKeyBinary.ExportPublicKeyBinaryMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmExportPublicKeyBinary.ExportPublicKeyBinaryMock.defaultExpectation.Counter, 1)
mm_want := mmExportPublicKeyBinary.ExportPublicKeyBinaryMock.defaultExpectation.params
mm_got := KeyProcessorMockExportPublicKeyBinaryParams{p1}
if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmExportPublicKeyBinary.t.Errorf("KeyProcessorMock.ExportPublicKeyBinary got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmExportPublicKeyBinary.ExportPublicKeyBinaryMock.defaultExpectation.results
if mm_results == nil {
mmExportPublicKeyBinary.t.Fatal("No results are set for the KeyProcessorMock.ExportPublicKeyBinary")
}
return (*mm_results).ba1, (*mm_results).err
}
if mmExportPublicKeyBinary.funcExportPublicKeyBinary != nil {
return mmExportPublicKeyBinary.funcExportPublicKeyBinary(p1)
}
mmExportPublicKeyBinary.t.Fatalf("Unexpected call to KeyProcessorMock.ExportPublicKeyBinary. %v", p1)
return
}
// ExportPublicKeyBinaryAfterCounter returns a count of finished KeyProcessorMock.ExportPublicKeyBinary invocations
func (mmExportPublicKeyBinary *KeyProcessorMock) ExportPublicKeyBinaryAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmExportPublicKeyBinary.afterExportPublicKeyBinaryCounter)
}
// ExportPublicKeyBinaryBeforeCounter returns a count of KeyProcessorMock.ExportPublicKeyBinary invocations
func (mmExportPublicKeyBinary *KeyProcessorMock) ExportPublicKeyBinaryBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmExportPublicKeyBinary.beforeExportPublicKeyBinaryCounter)
}
// Calls returns a list of arguments used in each call to KeyProcessorMock.ExportPublicKeyBinary.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmExportPublicKeyBinary *mKeyProcessorMockExportPublicKeyBinary) Calls() []*KeyProcessorMockExportPublicKeyBinaryParams {
mmExportPublicKeyBinary.mutex.RLock()
argCopy := make([]*KeyProcessorMockExportPublicKeyBinaryParams, len(mmExportPublicKeyBinary.callArgs))
copy(argCopy, mmExportPublicKeyBinary.callArgs)
mmExportPublicKeyBinary.mutex.RUnlock()
return argCopy
}
// MinimockExportPublicKeyBinaryDone returns true if the count of the ExportPublicKeyBinary invocations corresponds
// the number of defined expectations
func (m *KeyProcessorMock) MinimockExportPublicKeyBinaryDone() bool {
for _, e := range m.ExportPublicKeyBinaryMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
// if default expectation was set then invocations count should be greater than zero
if m.ExportPublicKeyBinaryMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterExportPublicKeyBinaryCounter) < 1 {
return false
}
// if func was set then invocations count should be greater than zero
if m.funcExportPublicKeyBinary != nil && mm_atomic.LoadUint64(&m.afterExportPublicKeyBinaryCounter) < 1 {
return false
}
return true
}
// MinimockExportPublicKeyBinaryInspect logs each unmet expectation
func (m *KeyProcessorMock) MinimockExportPublicKeyBinaryInspect() {
for _, e := range m.ExportPublicKeyBinaryMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to KeyProcessorMock.ExportPublicKeyBinary with params: %#v", *e.params)
}
}
// if default expectation was set then invocations count should be greater than zero
if m.ExportPublicKeyBinaryMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterExportPublicKeyBinaryCounter) < 1 {
if m.ExportPublicKeyBinaryMock.defaultExpectation.params == nil {
m.t.Error("Expected call to KeyProcessorMock.ExportPublicKeyBinary")
} else {
m.t.Errorf("Expected call to KeyProcessorMock.ExportPublicKeyBinary with params: %#v", *m.ExportPublicKeyBinaryMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcExportPublicKeyBinary != nil && mm_atomic.LoadUint64(&m.afterExportPublicKeyBinaryCounter) < 1 {
m.t.Error("Expected call to KeyProcessorMock.ExportPublicKeyBinary")
}
}
type mKeyProcessorMockExportPublicKeyPEM struct {
mock *KeyProcessorMock
defaultExpectation *KeyProcessorMockExportPublicKeyPEMExpectation
expectations []*KeyProcessorMockExportPublicKeyPEMExpectation
callArgs []*KeyProcessorMockExportPublicKeyPEMParams
mutex sync.RWMutex
}
// KeyProcessorMockExportPublicKeyPEMExpectation specifies expectation struct of the KeyProcessor.ExportPublicKeyPEM
type KeyProcessorMockExportPublicKeyPEMExpectation struct {
mock *KeyProcessorMock
params *KeyProcessorMockExportPublicKeyPEMParams
results *KeyProcessorMockExportPublicKeyPEMResults
Counter uint64
}
// KeyProcessorMockExportPublicKeyPEMParams contains parameters of the KeyProcessor.ExportPublicKeyPEM
type KeyProcessorMockExportPublicKeyPEMParams struct {
p1 crypto.PublicKey
}
// KeyProcessorMockExportPublicKeyPEMResults contains results of the KeyProcessor.ExportPublicKeyPEM
type KeyProcessorMockExportPublicKeyPEMResults struct {
ba1 []byte
err error
}
// Expect sets up expected params for KeyProcessor.ExportPublicKeyPEM
func (mmExportPublicKeyPEM *mKeyProcessorMockExportPublicKeyPEM) Expect(p1 crypto.PublicKey) *mKeyProcessorMockExportPublicKeyPEM {
if mmExportPublicKeyPEM.mock.funcExportPublicKeyPEM != nil {
mmExportPublicKeyPEM.mock.t.Fatalf("KeyProcessorMock.ExportPublicKeyPEM mock is already set by Set")
}
if mmExportPublicKeyPEM.defaultExpectation == nil {
mmExportPublicKeyPEM.defaultExpectation = &KeyProcessorMockExportPublicKeyPEMExpectation{}
}
mmExportPublicKeyPEM.defaultExpectation.params = &KeyProcessorMockExportPublicKeyPEMParams{p1}
for _, e := range mmExportPublicKeyPEM.expectations {
if minimock.Equal(e.params, mmExportPublicKeyPEM.defaultExpectation.params) {
mmExportPublicKeyPEM.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmExportPublicKeyPEM.defaultExpectation.params)
}
}
return mmExportPublicKeyPEM
}
// Inspect accepts an inspector function that has same arguments as the KeyProcessor.ExportPublicKeyPEM
func (mmExportPublicKeyPEM *mKeyProcessorMockExportPublicKeyPEM) Inspect(f func(p1 crypto.PublicKey)) *mKeyProcessorMockExportPublicKeyPEM {
if mmExportPublicKeyPEM.mock.inspectFuncExportPublicKeyPEM != nil {
mmExportPublicKeyPEM.mock.t.Fatalf("Inspect function is already set for KeyProcessorMock.ExportPublicKeyPEM")
}
mmExportPublicKeyPEM.mock.inspectFuncExportPublicKeyPEM = f
return mmExportPublicKeyPEM
}
// Return sets up results that will be returned by KeyProcessor.ExportPublicKeyPEM
func (mmExportPublicKeyPEM *mKeyProcessorMockExportPublicKeyPEM) Return(ba1 []byte, err error) *KeyProcessorMock {
if mmExportPublicKeyPEM.mock.funcExportPublicKeyPEM != nil {
mmExportPublicKeyPEM.mock.t.Fatalf("KeyProcessorMock.ExportPublicKeyPEM mock is already set by Set")
}
if mmExportPublicKeyPEM.defaultExpectation == nil {
mmExportPublicKeyPEM.defaultExpectation = &KeyProcessorMockExportPublicKeyPEMExpectation{mock: mmExportPublicKeyPEM.mock}
}
mmExportPublicKeyPEM.defaultExpectation.results = &KeyProcessorMockExportPublicKeyPEMResults{ba1, err}
return mmExportPublicKeyPEM.mock
}
//Set uses given function f to mock the KeyProcessor.ExportPublicKeyPEM method
func (mmExportPublicKeyPEM *mKeyProcessorMockExportPublicKeyPEM) Set(f func(p1 crypto.PublicKey) (ba1 []byte, err error)) *KeyProcessorMock {
if mmExportPublicKeyPEM.defaultExpectation != nil {
mmExportPublicKeyPEM.mock.t.Fatalf("Default expectation is already set for the KeyProcessor.ExportPublicKeyPEM method")
}
if len(mmExportPublicKeyPEM.expectations) > 0 {
mmExportPublicKeyPEM.mock.t.Fatalf("Some expectations are already set for the KeyProcessor.ExportPublicKeyPEM method")
}
mmExportPublicKeyPEM.mock.funcExportPublicKeyPEM = f
return mmExportPublicKeyPEM.mock
}
// When sets expectation for the KeyProcessor.ExportPublicKeyPEM which will trigger the result defined by the following
// Then helper
func (mmExportPublicKeyPEM *mKeyProcessorMockExportPublicKeyPEM) When(p1 crypto.PublicKey) *KeyProcessorMockExportPublicKeyPEMExpectation {
if mmExportPublicKeyPEM.mock.funcExportPublicKeyPEM != nil {
mmExportPublicKeyPEM.mock.t.Fatalf("KeyProcessorMock.ExportPublicKeyPEM mock is already set by Set")
}
expectation := &KeyProcessorMockExportPublicKeyPEMExpectation{
mock: mmExportPublicKeyPEM.mock,
params: &KeyProcessorMockExportPublicKeyPEMParams{p1},
}
mmExportPublicKeyPEM.expectations = append(mmExportPublicKeyPEM.expectations, expectation)
return expectation
}
// Then sets up KeyProcessor.ExportPublicKeyPEM return parameters for the expectation previously defined by the When method
func (e *KeyProcessorMockExportPublicKeyPEMExpectation) Then(ba1 []byte, err error) *KeyProcessorMock {
e.results = &KeyProcessorMockExportPublicKeyPEMResults{ba1, err}
return e.mock
}
// ExportPublicKeyPEM implements insolar.KeyProcessor
func (mmExportPublicKeyPEM *KeyProcessorMock) ExportPublicKeyPEM(p1 crypto.PublicKey) (ba1 []byte, err error) {
mm_atomic.AddUint64(&mmExportPublicKeyPEM.beforeExportPublicKeyPEMCounter, 1)
defer mm_atomic.AddUint64(&mmExportPublicKeyPEM.afterExportPublicKeyPEMCounter, 1)
if mmExportPublicKeyPEM.inspectFuncExportPublicKeyPEM != nil {
mmExportPublicKeyPEM.inspectFuncExportPublicKeyPEM(p1)
}
mm_params := &KeyProcessorMockExportPublicKeyPEMParams{p1}
// Record call args
mmExportPublicKeyPEM.ExportPublicKeyPEMMock.mutex.Lock()
mmExportPublicKeyPEM.ExportPublicKeyPEMMock.callArgs = append(mmExportPublicKeyPEM.ExportPublicKeyPEMMock.callArgs, mm_params)
mmExportPublicKeyPEM.ExportPublicKeyPEMMock.mutex.Unlock()
for _, e := range mmExportPublicKeyPEM.ExportPublicKeyPEMMock.expectations {
if minimock.Equal(e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.ba1, e.results.err
}
}
if mmExportPublicKeyPEM.ExportPublicKeyPEMMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmExportPublicKeyPEM.ExportPublicKeyPEMMock.defaultExpectation.Counter, 1)
mm_want := mmExportPublicKeyPEM.ExportPublicKeyPEMMock.defaultExpectation.params
mm_got := KeyProcessorMockExportPublicKeyPEMParams{p1}
if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmExportPublicKeyPEM.t.Errorf("KeyProcessorMock.ExportPublicKeyPEM got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmExportPublicKeyPEM.ExportPublicKeyPEMMock.defaultExpectation.results
if mm_results == nil {
mmExportPublicKeyPEM.t.Fatal("No results are set for the KeyProcessorMock.ExportPublicKeyPEM")
}
return (*mm_results).ba1, (*mm_results).err
}
if mmExportPublicKeyPEM.funcExportPublicKeyPEM != nil {
return mmExportPublicKeyPEM.funcExportPublicKeyPEM(p1)
}
mmExportPublicKeyPEM.t.Fatalf("Unexpected call to KeyProcessorMock.ExportPublicKeyPEM. %v", p1)
return
}
// ExportPublicKeyPEMAfterCounter returns a count of finished KeyProcessorMock.ExportPublicKeyPEM invocations
func (mmExportPublicKeyPEM *KeyProcessorMock) ExportPublicKeyPEMAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmExportPublicKeyPEM.afterExportPublicKeyPEMCounter)
}
// ExportPublicKeyPEMBeforeCounter returns a count of KeyProcessorMock.ExportPublicKeyPEM invocations
func (mmExportPublicKeyPEM *KeyProcessorMock) ExportPublicKeyPEMBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmExportPublicKeyPEM.beforeExportPublicKeyPEMCounter)
}
// Calls returns a list of arguments used in each call to KeyProcessorMock.ExportPublicKeyPEM.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmExportPublicKeyPEM *mKeyProcessorMockExportPublicKeyPEM) Calls() []*KeyProcessorMockExportPublicKeyPEMParams {
mmExportPublicKeyPEM.mutex.RLock()
argCopy := make([]*KeyProcessorMockExportPublicKeyPEMParams, len(mmExportPublicKeyPEM.callArgs))
copy(argCopy, mmExportPublicKeyPEM.callArgs)
mmExportPublicKeyPEM.mutex.RUnlock()
return argCopy
}
// MinimockExportPublicKeyPEMDone returns true if the count of the ExportPublicKeyPEM invocations corresponds
// the number of defined expectations
func (m *KeyProcessorMock) MinimockExportPublicKeyPEMDone() bool {
for _, e := range m.ExportPublicKeyPEMMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
// if default expectation was set then invocations count should be greater than zero
if m.ExportPublicKeyPEMMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterExportPublicKeyPEMCounter) < 1 {
return false
}
// if func was set then invocations count should be greater than zero
if m.funcExportPublicKeyPEM != nil && mm_atomic.LoadUint64(&m.afterExportPublicKeyPEMCounter) < 1 {
return false
}
return true
}
// MinimockExportPublicKeyPEMInspect logs each unmet expectation
func (m *KeyProcessorMock) MinimockExportPublicKeyPEMInspect() {
for _, e := range m.ExportPublicKeyPEMMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to KeyProcessorMock.ExportPublicKeyPEM with params: %#v", *e.params)
}
}
// if default expectation was set then invocations count should be greater than zero
if m.ExportPublicKeyPEMMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterExportPublicKeyPEMCounter) < 1 {
if m.ExportPublicKeyPEMMock.defaultExpectation.params == nil {
m.t.Error("Expected call to KeyProcessorMock.ExportPublicKeyPEM")
} else {
m.t.Errorf("Expected call to KeyProcessorMock.ExportPublicKeyPEM with params: %#v", *m.ExportPublicKeyPEMMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcExportPublicKeyPEM != nil && mm_atomic.LoadUint64(&m.afterExportPublicKeyPEMCounter) < 1 {
m.t.Error("Expected call to KeyProcessorMock.ExportPublicKeyPEM")
}
}
type mKeyProcessorMockExtractPublicKey struct {
mock *KeyProcessorMock
defaultExpectation *KeyProcessorMockExtractPublicKeyExpectation
expectations []*KeyProcessorMockExtractPublicKeyExpectation
callArgs []*KeyProcessorMockExtractPublicKeyParams
mutex sync.RWMutex
}
// KeyProcessorMockExtractPublicKeyExpectation specifies expectation struct of the KeyProcessor.ExtractPublicKey
type KeyProcessorMockExtractPublicKeyExpectation struct {
mock *KeyProcessorMock
params *KeyProcessorMockExtractPublicKeyParams
results *KeyProcessorMockExtractPublicKeyResults
Counter uint64
}
// KeyProcessorMockExtractPublicKeyParams contains parameters of the KeyProcessor.ExtractPublicKey
type KeyProcessorMockExtractPublicKeyParams struct {
p1 crypto.PrivateKey
}
// KeyProcessorMockExtractPublicKeyResults contains results of the KeyProcessor.ExtractPublicKey
type KeyProcessorMockExtractPublicKeyResults struct {
p2 crypto.PublicKey
}
// Expect sets up expected params for KeyProcessor.ExtractPublicKey
func (mmExtractPublicKey *mKeyProcessorMockExtractPublicKey) Expect(p1 crypto.PrivateKey) *mKeyProcessorMockExtractPublicKey {
if mmExtractPublicKey.mock.funcExtractPublicKey != nil {
mmExtractPublicKey.mock.t.Fatalf("KeyProcessorMock.ExtractPublicKey mock is already set by Set")
}
if mmExtractPublicKey.defaultExpectation == nil {
mmExtractPublicKey.defaultExpectation = &KeyProcessorMockExtractPublicKeyExpectation{}
}
mmExtractPublicKey.defaultExpectation.params = &KeyProcessorMockExtractPublicKeyParams{p1}
for _, e := range mmExtractPublicKey.expectations {
if minimock.Equal(e.params, mmExtractPublicKey.defaultExpectation.params) {
mmExtractPublicKey.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmExtractPublicKey.defaultExpectation.params)
}
}
return mmExtractPublicKey
}
// Inspect accepts an inspector function that has same arguments as the KeyProcessor.ExtractPublicKey
func (mmExtractPublicKey *mKeyProcessorMockExtractPublicKey) Inspect(f func(p1 crypto.PrivateKey)) *mKeyProcessorMockExtractPublicKey {
if mmExtractPublicKey.mock.inspectFuncExtractPublicKey != nil {
mmExtractPublicKey.mock.t.Fatalf("Inspect function is already set for KeyProcessorMock.ExtractPublicKey")
}
mmExtractPublicKey.mock.inspectFuncExtractPublicKey = f
return mmExtractPublicKey
}
// Return sets up results that will be returned by KeyProcessor.ExtractPublicKey
func (mmExtractPublicKey *mKeyProcessorMockExtractPublicKey) Return(p2 crypto.PublicKey) *KeyProcessorMock {
if mmExtractPublicKey.mock.funcExtractPublicKey != nil {
mmExtractPublicKey.mock.t.Fatalf("KeyProcessorMock.ExtractPublicKey mock is already set by Set")
}
if mmExtractPublicKey.defaultExpectation == nil {
mmExtractPublicKey.defaultExpectation = &KeyProcessorMockExtractPublicKeyExpectation{mock: mmExtractPublicKey.mock}
}
mmExtractPublicKey.defaultExpectation.results = &KeyProcessorMockExtractPublicKeyResults{p2}
return mmExtractPublicKey.mock
}
//Set uses given function f to mock the KeyProcessor.ExtractPublicKey method
func (mmExtractPublicKey *mKeyProcessorMockExtractPublicKey) Set(f func(p1 crypto.PrivateKey) (p2 crypto.PublicKey)) *KeyProcessorMock {
if mmExtractPublicKey.defaultExpectation != nil {
mmExtractPublicKey.mock.t.Fatalf("Default expectation is already set for the KeyProcessor.ExtractPublicKey method")
}
if len(mmExtractPublicKey.expectations) > 0 {
mmExtractPublicKey.mock.t.Fatalf("Some expectations are already set for the KeyProcessor.ExtractPublicKey method")
}
mmExtractPublicKey.mock.funcExtractPublicKey = f
return mmExtractPublicKey.mock
}
// When sets expectation for the KeyProcessor.ExtractPublicKey which will trigger the result defined by the following
// Then helper
func (mmExtractPublicKey *mKeyProcessorMockExtractPublicKey) When(p1 crypto.PrivateKey) *KeyProcessorMockExtractPublicKeyExpectation {
if mmExtractPublicKey.mock.funcExtractPublicKey != nil {
mmExtractPublicKey.mock.t.Fatalf("KeyProcessorMock.ExtractPublicKey mock is already set by Set")
}
expectation := &KeyProcessorMockExtractPublicKeyExpectation{
mock: mmExtractPublicKey.mock,
params: &KeyProcessorMockExtractPublicKeyParams{p1},
}
mmExtractPublicKey.expectations = append(mmExtractPublicKey.expectations, expectation)
return expectation
}
// Then sets up KeyProcessor.ExtractPublicKey return parameters for the expectation previously defined by the When method
func (e *KeyProcessorMockExtractPublicKeyExpectation) Then(p2 crypto.PublicKey) *KeyProcessorMock {
e.results = &KeyProcessorMockExtractPublicKeyResults{p2}
return e.mock
}
// ExtractPublicKey implements insolar.KeyProcessor
func (mmExtractPublicKey *KeyProcessorMock) ExtractPublicKey(p1 crypto.PrivateKey) (p2 crypto.PublicKey) {
mm_atomic.AddUint64(&mmExtractPublicKey.beforeExtractPublicKeyCounter, 1)
defer mm_atomic.AddUint64(&mmExtractPublicKey.afterExtractPublicKeyCounter, 1)
if mmExtractPublicKey.inspectFuncExtractPublicKey != nil {
mmExtractPublicKey.inspectFuncExtractPublicKey(p1)
}
mm_params := &KeyProcessorMockExtractPublicKeyParams{p1}
// Record call args
mmExtractPublicKey.ExtractPublicKeyMock.mutex.Lock()
mmExtractPublicKey.ExtractPublicKeyMock.callArgs = append(mmExtractPublicKey.ExtractPublicKeyMock.callArgs, mm_params)
mmExtractPublicKey.ExtractPublicKeyMock.mutex.Unlock()
for _, e := range mmExtractPublicKey.ExtractPublicKeyMock.expectations {
if minimock.Equal(e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.p2
}
}
if mmExtractPublicKey.ExtractPublicKeyMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmExtractPublicKey.ExtractPublicKeyMock.defaultExpectation.Counter, 1)
mm_want := mmExtractPublicKey.ExtractPublicKeyMock.defaultExpectation.params
mm_got := KeyProcessorMockExtractPublicKeyParams{p1}
if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmExtractPublicKey.t.Errorf("KeyProcessorMock.ExtractPublicKey got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmExtractPublicKey.ExtractPublicKeyMock.defaultExpectation.results
if mm_results == nil {
mmExtractPublicKey.t.Fatal("No results are set for the KeyProcessorMock.ExtractPublicKey")
}
return (*mm_results).p2
}
if mmExtractPublicKey.funcExtractPublicKey != nil {
return mmExtractPublicKey.funcExtractPublicKey(p1)
}
mmExtractPublicKey.t.Fatalf("Unexpected call to KeyProcessorMock.ExtractPublicKey. %v", p1)
return
}
// ExtractPublicKeyAfterCounter returns a count of finished KeyProcessorMock.ExtractPublicKey invocations
func (mmExtractPublicKey *KeyProcessorMock) ExtractPublicKeyAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmExtractPublicKey.afterExtractPublicKeyCounter)
}
// ExtractPublicKeyBeforeCounter returns a count of KeyProcessorMock.ExtractPublicKey invocations
func (mmExtractPublicKey *KeyProcessorMock) ExtractPublicKeyBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmExtractPublicKey.beforeExtractPublicKeyCounter)
}
// Calls returns a list of arguments used in each call to KeyProcessorMock.ExtractPublicKey.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmExtractPublicKey *mKeyProcessorMockExtractPublicKey) Calls() []*KeyProcessorMockExtractPublicKeyParams {
mmExtractPublicKey.mutex.RLock()
argCopy := make([]*KeyProcessorMockExtractPublicKeyParams, len(mmExtractPublicKey.callArgs))
copy(argCopy, mmExtractPublicKey.callArgs)
mmExtractPublicKey.mutex.RUnlock()
return argCopy
}
// MinimockExtractPublicKeyDone returns true if the count of the ExtractPublicKey invocations corresponds
// the number of defined expectations
func (m *KeyProcessorMock) MinimockExtractPublicKeyDone() bool {
for _, e := range m.ExtractPublicKeyMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
// if default expectation was set then invocations count should be greater than zero
if m.ExtractPublicKeyMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterExtractPublicKeyCounter) < 1 {
return false
}
// if func was set then invocations count should be greater than zero
if m.funcExtractPublicKey != nil && mm_atomic.LoadUint64(&m.afterExtractPublicKeyCounter) < 1 {
return false
}
return true
}
// MinimockExtractPublicKeyInspect logs each unmet expectation
func (m *KeyProcessorMock) MinimockExtractPublicKeyInspect() {
for _, e := range m.ExtractPublicKeyMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to KeyProcessorMock.ExtractPublicKey with params: %#v", *e.params)
}
}
// if default expectation was set then invocations count should be greater than zero
if m.ExtractPublicKeyMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterExtractPublicKeyCounter) < 1 {
if m.ExtractPublicKeyMock.defaultExpectation.params == nil {
m.t.Error("Expected call to KeyProcessorMock.ExtractPublicKey")
} else {
m.t.Errorf("Expected call to KeyProcessorMock.ExtractPublicKey with params: %#v", *m.ExtractPublicKeyMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcExtractPublicKey != nil && mm_atomic.LoadUint64(&m.afterExtractPublicKeyCounter) < 1 {
m.t.Error("Expected call to KeyProcessorMock.ExtractPublicKey")
}
}
type mKeyProcessorMockGeneratePrivateKey struct {
mock *KeyProcessorMock
defaultExpectation *KeyProcessorMockGeneratePrivateKeyExpectation
expectations []*KeyProcessorMockGeneratePrivateKeyExpectation
}
// KeyProcessorMockGeneratePrivateKeyExpectation specifies expectation struct of the KeyProcessor.GeneratePrivateKey
type KeyProcessorMockGeneratePrivateKeyExpectation struct {
mock *KeyProcessorMock
results *KeyProcessorMockGeneratePrivateKeyResults
Counter uint64
}
// KeyProcessorMockGeneratePrivateKeyResults contains results of the KeyProcessor.GeneratePrivateKey
type KeyProcessorMockGeneratePrivateKeyResults struct {
p1 crypto.PrivateKey
err error
}
// Expect sets up expected params for KeyProcessor.GeneratePrivateKey
func (mmGeneratePrivateKey *mKeyProcessorMockGeneratePrivateKey) Expect() *mKeyProcessorMockGeneratePrivateKey {
if mmGeneratePrivateKey.mock.funcGeneratePrivateKey != nil {
mmGeneratePrivateKey.mock.t.Fatalf("KeyProcessorMock.GeneratePrivateKey mock is already set by Set")
}
if mmGeneratePrivateKey.defaultExpectation == nil {
mmGeneratePrivateKey.defaultExpectation = &KeyProcessorMockGeneratePrivateKeyExpectation{}
}
return mmGeneratePrivateKey
}
// Inspect accepts an inspector function that has same arguments as the KeyProcessor.GeneratePrivateKey
func (mmGeneratePrivateKey *mKeyProcessorMockGeneratePrivateKey) Inspect(f func()) *mKeyProcessorMockGeneratePrivateKey {
if mmGeneratePrivateKey.mock.inspectFuncGeneratePrivateKey != nil {
mmGeneratePrivateKey.mock.t.Fatalf("Inspect function is already set for KeyProcessorMock.GeneratePrivateKey")
}