-
Notifications
You must be signed in to change notification settings - Fork 105
/
expected_keepers.go
337 lines (313 loc) · 12.6 KB
/
expected_keepers.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
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package mock
import (
"github.com/axelarnetwork/axelar-core/x/snapshot/types"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"sync"
)
// Ensure, that StakingKeeperMock does implement types.StakingKeeper.
// If this is not the case, regenerate this file with moq.
var _ types.StakingKeeper = &StakingKeeperMock{}
// StakingKeeperMock is a mock implementation of types.StakingKeeper.
//
// func TestSomethingThatUsesStakingKeeper(t *testing.T) {
//
// // make and configure a mocked types.StakingKeeper
// mockedStakingKeeper := &StakingKeeperMock{
// BondDenomFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context) string {
// panic("mock out the BondDenom method")
// },
// GetLastTotalPowerFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context) github_com_cosmos_cosmos_sdk_types.Int {
// panic("mock out the GetLastTotalPower method")
// },
// IterateBondedValidatorsByPowerFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool)) {
// panic("mock out the IterateBondedValidatorsByPower method")
// },
// PowerReductionFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context) github_com_cosmos_cosmos_sdk_types.Int {
// panic("mock out the PowerReduction method")
// },
// ValidatorFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, addr github_com_cosmos_cosmos_sdk_types.ValAddress) stakingtypes.ValidatorI {
// panic("mock out the Validator method")
// },
// }
//
// // use mockedStakingKeeper in code that requires types.StakingKeeper
// // and then make assertions.
//
// }
type StakingKeeperMock struct {
// BondDenomFunc mocks the BondDenom method.
BondDenomFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context) string
// GetLastTotalPowerFunc mocks the GetLastTotalPower method.
GetLastTotalPowerFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context) github_com_cosmos_cosmos_sdk_types.Int
// IterateBondedValidatorsByPowerFunc mocks the IterateBondedValidatorsByPower method.
IterateBondedValidatorsByPowerFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool))
// PowerReductionFunc mocks the PowerReduction method.
PowerReductionFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context) github_com_cosmos_cosmos_sdk_types.Int
// ValidatorFunc mocks the Validator method.
ValidatorFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, addr github_com_cosmos_cosmos_sdk_types.ValAddress) stakingtypes.ValidatorI
// calls tracks calls to the methods.
calls struct {
// BondDenom holds details about calls to the BondDenom method.
BondDenom []struct {
// Ctx is the ctx argument value.
Ctx github_com_cosmos_cosmos_sdk_types.Context
}
// GetLastTotalPower holds details about calls to the GetLastTotalPower method.
GetLastTotalPower []struct {
// Ctx is the ctx argument value.
Ctx github_com_cosmos_cosmos_sdk_types.Context
}
// IterateBondedValidatorsByPower holds details about calls to the IterateBondedValidatorsByPower method.
IterateBondedValidatorsByPower []struct {
// Ctx is the ctx argument value.
Ctx github_com_cosmos_cosmos_sdk_types.Context
// Fn is the fn argument value.
Fn func(index int64, validator stakingtypes.ValidatorI) (stop bool)
}
// PowerReduction holds details about calls to the PowerReduction method.
PowerReduction []struct {
// Ctx is the ctx argument value.
Ctx github_com_cosmos_cosmos_sdk_types.Context
}
// Validator holds details about calls to the Validator method.
Validator []struct {
// Ctx is the ctx argument value.
Ctx github_com_cosmos_cosmos_sdk_types.Context
// Addr is the addr argument value.
Addr github_com_cosmos_cosmos_sdk_types.ValAddress
}
}
lockBondDenom sync.RWMutex
lockGetLastTotalPower sync.RWMutex
lockIterateBondedValidatorsByPower sync.RWMutex
lockPowerReduction sync.RWMutex
lockValidator sync.RWMutex
}
// BondDenom calls BondDenomFunc.
func (mock *StakingKeeperMock) BondDenom(ctx github_com_cosmos_cosmos_sdk_types.Context) string {
if mock.BondDenomFunc == nil {
panic("StakingKeeperMock.BondDenomFunc: method is nil but StakingKeeper.BondDenom was just called")
}
callInfo := struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
}{
Ctx: ctx,
}
mock.lockBondDenom.Lock()
mock.calls.BondDenom = append(mock.calls.BondDenom, callInfo)
mock.lockBondDenom.Unlock()
return mock.BondDenomFunc(ctx)
}
// BondDenomCalls gets all the calls that were made to BondDenom.
// Check the length with:
// len(mockedStakingKeeper.BondDenomCalls())
func (mock *StakingKeeperMock) BondDenomCalls() []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
} {
var calls []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
}
mock.lockBondDenom.RLock()
calls = mock.calls.BondDenom
mock.lockBondDenom.RUnlock()
return calls
}
// GetLastTotalPower calls GetLastTotalPowerFunc.
func (mock *StakingKeeperMock) GetLastTotalPower(ctx github_com_cosmos_cosmos_sdk_types.Context) github_com_cosmos_cosmos_sdk_types.Int {
if mock.GetLastTotalPowerFunc == nil {
panic("StakingKeeperMock.GetLastTotalPowerFunc: method is nil but StakingKeeper.GetLastTotalPower was just called")
}
callInfo := struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
}{
Ctx: ctx,
}
mock.lockGetLastTotalPower.Lock()
mock.calls.GetLastTotalPower = append(mock.calls.GetLastTotalPower, callInfo)
mock.lockGetLastTotalPower.Unlock()
return mock.GetLastTotalPowerFunc(ctx)
}
// GetLastTotalPowerCalls gets all the calls that were made to GetLastTotalPower.
// Check the length with:
// len(mockedStakingKeeper.GetLastTotalPowerCalls())
func (mock *StakingKeeperMock) GetLastTotalPowerCalls() []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
} {
var calls []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
}
mock.lockGetLastTotalPower.RLock()
calls = mock.calls.GetLastTotalPower
mock.lockGetLastTotalPower.RUnlock()
return calls
}
// IterateBondedValidatorsByPower calls IterateBondedValidatorsByPowerFunc.
func (mock *StakingKeeperMock) IterateBondedValidatorsByPower(ctx github_com_cosmos_cosmos_sdk_types.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool)) {
if mock.IterateBondedValidatorsByPowerFunc == nil {
panic("StakingKeeperMock.IterateBondedValidatorsByPowerFunc: method is nil but StakingKeeper.IterateBondedValidatorsByPower was just called")
}
callInfo := struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Fn func(index int64, validator stakingtypes.ValidatorI) (stop bool)
}{
Ctx: ctx,
Fn: fn,
}
mock.lockIterateBondedValidatorsByPower.Lock()
mock.calls.IterateBondedValidatorsByPower = append(mock.calls.IterateBondedValidatorsByPower, callInfo)
mock.lockIterateBondedValidatorsByPower.Unlock()
mock.IterateBondedValidatorsByPowerFunc(ctx, fn)
}
// IterateBondedValidatorsByPowerCalls gets all the calls that were made to IterateBondedValidatorsByPower.
// Check the length with:
// len(mockedStakingKeeper.IterateBondedValidatorsByPowerCalls())
func (mock *StakingKeeperMock) IterateBondedValidatorsByPowerCalls() []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Fn func(index int64, validator stakingtypes.ValidatorI) (stop bool)
} {
var calls []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Fn func(index int64, validator stakingtypes.ValidatorI) (stop bool)
}
mock.lockIterateBondedValidatorsByPower.RLock()
calls = mock.calls.IterateBondedValidatorsByPower
mock.lockIterateBondedValidatorsByPower.RUnlock()
return calls
}
// PowerReduction calls PowerReductionFunc.
func (mock *StakingKeeperMock) PowerReduction(ctx github_com_cosmos_cosmos_sdk_types.Context) github_com_cosmos_cosmos_sdk_types.Int {
if mock.PowerReductionFunc == nil {
panic("StakingKeeperMock.PowerReductionFunc: method is nil but StakingKeeper.PowerReduction was just called")
}
callInfo := struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
}{
Ctx: ctx,
}
mock.lockPowerReduction.Lock()
mock.calls.PowerReduction = append(mock.calls.PowerReduction, callInfo)
mock.lockPowerReduction.Unlock()
return mock.PowerReductionFunc(ctx)
}
// PowerReductionCalls gets all the calls that were made to PowerReduction.
// Check the length with:
// len(mockedStakingKeeper.PowerReductionCalls())
func (mock *StakingKeeperMock) PowerReductionCalls() []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
} {
var calls []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
}
mock.lockPowerReduction.RLock()
calls = mock.calls.PowerReduction
mock.lockPowerReduction.RUnlock()
return calls
}
// Validator calls ValidatorFunc.
func (mock *StakingKeeperMock) Validator(ctx github_com_cosmos_cosmos_sdk_types.Context, addr github_com_cosmos_cosmos_sdk_types.ValAddress) stakingtypes.ValidatorI {
if mock.ValidatorFunc == nil {
panic("StakingKeeperMock.ValidatorFunc: method is nil but StakingKeeper.Validator was just called")
}
callInfo := struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Addr github_com_cosmos_cosmos_sdk_types.ValAddress
}{
Ctx: ctx,
Addr: addr,
}
mock.lockValidator.Lock()
mock.calls.Validator = append(mock.calls.Validator, callInfo)
mock.lockValidator.Unlock()
return mock.ValidatorFunc(ctx, addr)
}
// ValidatorCalls gets all the calls that were made to Validator.
// Check the length with:
// len(mockedStakingKeeper.ValidatorCalls())
func (mock *StakingKeeperMock) ValidatorCalls() []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Addr github_com_cosmos_cosmos_sdk_types.ValAddress
} {
var calls []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Addr github_com_cosmos_cosmos_sdk_types.ValAddress
}
mock.lockValidator.RLock()
calls = mock.calls.Validator
mock.lockValidator.RUnlock()
return calls
}
// Ensure, that BankKeeperMock does implement types.BankKeeper.
// If this is not the case, regenerate this file with moq.
var _ types.BankKeeper = &BankKeeperMock{}
// BankKeeperMock is a mock implementation of types.BankKeeper.
//
// func TestSomethingThatUsesBankKeeper(t *testing.T) {
//
// // make and configure a mocked types.BankKeeper
// mockedBankKeeper := &BankKeeperMock{
// GetBalanceFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, addr github_com_cosmos_cosmos_sdk_types.AccAddress, denom string) github_com_cosmos_cosmos_sdk_types.Coin {
// panic("mock out the GetBalance method")
// },
// }
//
// // use mockedBankKeeper in code that requires types.BankKeeper
// // and then make assertions.
//
// }
type BankKeeperMock struct {
// GetBalanceFunc mocks the GetBalance method.
GetBalanceFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, addr github_com_cosmos_cosmos_sdk_types.AccAddress, denom string) github_com_cosmos_cosmos_sdk_types.Coin
// calls tracks calls to the methods.
calls struct {
// GetBalance holds details about calls to the GetBalance method.
GetBalance []struct {
// Ctx is the ctx argument value.
Ctx github_com_cosmos_cosmos_sdk_types.Context
// Addr is the addr argument value.
Addr github_com_cosmos_cosmos_sdk_types.AccAddress
// Denom is the denom argument value.
Denom string
}
}
lockGetBalance sync.RWMutex
}
// GetBalance calls GetBalanceFunc.
func (mock *BankKeeperMock) GetBalance(ctx github_com_cosmos_cosmos_sdk_types.Context, addr github_com_cosmos_cosmos_sdk_types.AccAddress, denom string) github_com_cosmos_cosmos_sdk_types.Coin {
if mock.GetBalanceFunc == nil {
panic("BankKeeperMock.GetBalanceFunc: method is nil but BankKeeper.GetBalance was just called")
}
callInfo := struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Addr github_com_cosmos_cosmos_sdk_types.AccAddress
Denom string
}{
Ctx: ctx,
Addr: addr,
Denom: denom,
}
mock.lockGetBalance.Lock()
mock.calls.GetBalance = append(mock.calls.GetBalance, callInfo)
mock.lockGetBalance.Unlock()
return mock.GetBalanceFunc(ctx, addr, denom)
}
// GetBalanceCalls gets all the calls that were made to GetBalance.
// Check the length with:
// len(mockedBankKeeper.GetBalanceCalls())
func (mock *BankKeeperMock) GetBalanceCalls() []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Addr github_com_cosmos_cosmos_sdk_types.AccAddress
Denom string
} {
var calls []struct {
Ctx github_com_cosmos_cosmos_sdk_types.Context
Addr github_com_cosmos_cosmos_sdk_types.AccAddress
Denom string
}
mock.lockGetBalance.RLock()
calls = mock.calls.GetBalance
mock.lockGetBalance.RUnlock()
return calls
}